You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varscript=" var sum = 0; for( a in angles ) sum += Math.cos(a); sum; ";
varparser=newhscript.Parser();
varprogram=parser.parseString(script);
varinterp=newhscript.Interp();
interp.variables.set("Math",Math); // share the Math classinterp.variables.set("angles",[0,1,2,3]); // set the angles listtrace( interp.execute(program) );
with latest haxe 4.1.2 and hashlink 1.11.0, I get the error "Invalid function null" when it tries to find the cos function in Math. This -appears- to be a hashlink bug? But I'm not entirely sure if maybe there's a way around it that should be done in hscript instead.
The code executes as expected with both js and interp.
Reflect.getProperty(Math, "cos"); //null for HashLink target
The text was updated successfully, but these errors were encountered:
Was investigating this bug and found a 4 year unresolved issue, sad.
I discovered that interestingly you can get around this by creating a class that wraps the inaccessible functions and use it instead of std.Math, like so:
While trying to follow the example code
with latest haxe 4.1.2 and hashlink 1.11.0, I get the error "Invalid function null" when it tries to find the cos function in Math. This -appears- to be a hashlink bug? But I'm not entirely sure if maybe there's a way around it that should be done in hscript instead.
The code executes as expected with both js and interp.
The text was updated successfully, but these errors were encountered: