Rhino

Rhino

34M Downloads

Interaction with JS objects is wierd

C0D3-M4513R opened this issue ยท 0 comments

commented

''.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