Sunday 15 February 2015

c++ - Using global functions in AngelScript -



c++ - Using global functions in AngelScript -

i have problem create utilize of angelscripts global functions within c++-application.

in .cpp file have function:

int multi(int x, int y) { int z = x * y; cout << x << endl; cout << y << endl; homecoming z; }

i'm registering using:

engine->registerglobalfunction("int multi(int &out, int &out)", asfunction(multi), ascall_cdecl);

in .as file phone call function this:

multi(1, 2);

so in case want x 1 , y 2, when print values cout it's x = 4318096 , y = 4318100.

i can't figure out error is. appreciate help can get.

you register function wrong. should be:

engine->registerglobalfunction("int multi(int, int)", asfunction(multi), ascall_cdecl);

out means function utilize parameter output.

c++ angelscript

No comments:

Post a Comment