hscript icon indicating copy to clipboard operation
hscript copied to clipboard

Can't reference classes

Open hopewise opened this issue 5 years ago • 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?

hopewise avatar May 29 '19 06:05 hopewise

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

ncannasse avatar May 29 '19 09:05 ncannasse

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

hopewise avatar May 29 '19 14:05 hopewise

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

ncannasse avatar May 31 '19 13:05 ncannasse

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

hopewise avatar Jun 02 '19 07:06 hopewise