Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction with JS objects is wierd #34

Open
C0D3-M4513R opened this issue Feb 4, 2023 · 0 comments
Open

Interaction with JS objects is wierd #34

C0D3-M4513R opened this issue Feb 4, 2023 · 0 comments

Comments

@C0D3-M4513R
Copy link

C0D3-M4513R commented Feb 4, 2023

''.getClass or ''['getClass'] throws an exception upon load/reload instead of returning undefined.
I should be able to access any and every key in a JS object without having to worry about java exceptions.
Whenever a key doesn't exist just return undefined, as is JS convention.

Also java('net.minecraft.network.chat.Component') results in a class of type java.lang.Class, but the fuction getName is apparently not defined. (Error loading KubeJS script: Java class "net.minecraft.network.chat.Component" has no public instance field or method named "getName".)
In this case I would expect typeof java('net.minecraft.network.chat.Component').getName === 'undefined', and java('net.minecraft.network.chat.Component').getName() to error in Cannot call Undefined or something like that.

Initial discussion on Discord: https://discord.com/channels/303440391124942858/1069124194786361364/1069124194786361364

@C0D3-M4513R C0D3-M4513R changed the title Java java.lang.Class interaction with JS objects is wierd Interaction with JS objects is wierd Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant