Hey! I'm new to hscript, and I was wondering how to make a script return a different function result.
For example, say I had something like this as an hscript (pseudocode):
function a()
{
return 5;
}
function b()
{
return 1;
}
How can I compile that script once, and decide from Haxe which function to call to get the result of my script, a or b? I know I could pass in variables, and those variables could call something different at the end of the script, like so:
if (useA)
{
return a();
}
else
{
return b();
}
but I'm planning on having lots of user defined scripts, and lots of functions in my scripts, and I don't want them to have to have this pseudocode at the end of them all. I know of course that I could just compile the script a bunch of different times with different function calls at the end, but it seems like it'd be nice to be able to just compile it once...
Thanks,
Brad