HaxeFoundation/hscript

Can't reference classes

hopewise opened this issue · 4 comments

it seems that hscript interpreter could not recognize my classes if I used them into script.

ex: I used my classMain , I got error when tried to execute:

js__$Boot_HaxeError {val: {…}, stack: "Error: EUnknownVariable(Main)↵    at hscript_Inter

I used to import my class Main at the same place where I execute the script.

I also, tried to use the full package name to reference the Main class com.clientside.main.Main, I got error:

v: "com"
__enum__: "hscript.Error"
stack: Error: EUnknownVariable(com)

Any idea?

You must share the class explicitely with variables.set("Main", Main)

I am already doing so, actually, but I still get the same error..

That must be an error on your side, as EUnkownVariable is only throw is the key does not exists in variables Map

I have created a minimal sample app to show my problem, please bear with me as I am showing the library StablexUI which uses hscript at here
I have successfully registered some types as here however, I could not register my own classes

why my classes are not registrable?
I hope you can have a look at this minimal sample app, thank you