HaxeFoundation / HaxeFoundation/hscript
Math.cos example fails when targeting HashLink
- Dominant language
- Haxe
- Stars
- 309
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Description
While trying to follow the example code
```haxe
var script = "
var sum = 0;
for( a in angles )
sum += Math.cos(a);
sum;
";
var parser = new hscript.Parser();
var program = parser.parseString(script);
var interp = new hscript.Interp();
interp.variables.set("Math",Math); // share the Math class
interp.variables.set("angles",[0,1,2,3]); // set the angles list
trace( 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.
```haxe
Reflect.getProperty(Math, "cos"); //null for HashLink target
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.