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
I have a number of c++ functions which take a number of parameters, some of which are floats, and some ints. I've noticed that dascript is strict with making sure types agree exactly, which of course is as it should be.
However, I would like a way to allow some automatic type conversions (int to float, and vice versa) when interfacing with a c++ function.
For example, if I have a c++ function registered in dascript :
float sum(float a, float v)
{
return a+b;
}
And I call it from dascript like this:
var dist:int
dist=4
tot=sum(3.2,dist)
Is it possible to configure dascript to not complain during compilation, but to cast the variable dist to a float, and pass it to the c++ function?
I could define and register functions with every possible combination of variable types - but the combinatorics could make that difficult, so I was wondering if there was a more elegant way of achieving this.
Thanks a lot for any advice you might have.
Matt
The text was updated successfully, but these errors were encountered:
Hi again,
I have a number of c++ functions which take a number of parameters, some of which are floats, and some ints. I've noticed that dascript is strict with making sure types agree exactly, which of course is as it should be.
However, I would like a way to allow some automatic type conversions (int to float, and vice versa) when interfacing with a c++ function.
For example, if I have a c++ function registered in dascript :
float sum(float a, float v)
{
return a+b;
}
And I call it from dascript like this:
var dist:int
dist=4
tot=sum(3.2,dist)
Is it possible to configure dascript to not complain during compilation, but to cast the variable dist to a float, and pass it to the c++ function?
I could define and register functions with every possible combination of variable types - but the combinatorics could make that difficult, so I was wondering if there was a more elegant way of achieving this.
Thanks a lot for any advice you might have.
Matt
The text was updated successfully, but these errors were encountered: