🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Passing script struct without 'any' type?

Started by
1 comment, last by e c h o 18 years, 9 months ago
Can you pass a struct created in script without using the 'any' type? ie, do I have to do this: struct my_struct { int foo; }; void scriptfunc( any this_any ) { my_struct @this_obj; this_any.Retrieve( this_obj ); this_obj.foo++; // Do I need to save the this_obj back into this_any? } Sorry if the syntax isn't correct, I don't have my code in front of me right now. Also, can you save a script struct to the application without running a script to create it? I'd rather not fill my script code with CreateMyStruct( any this_any ); like functions. Does CreateScriptObject() do the trick? thnx /echo (waiting for script struct methods ;) *edit* That script function "scriptfunc" is meant to be called from the application. [Edited by - e c h o on September 30, 2005 5:51:26 AM]
admit nothing, deny everything and make counter accusations.
Advertisement
Yes, CreateScriptObject() can create the script structure for you. Obtain the type id for the script structure with GetTypeIdByDecl(). The script structure can then be passed to the script function using SetArgObject().

It's not yet possible to register application functions that expect a script structure though. I plan on fixing this, by allowing the application to prototype the script structure, just like it would be done in C++.

Methods for the structures are coming, but I can't say when.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Alright
thnx for the reply
admit nothing, deny everything and make counter accusations.

This topic is closed to new replies.

Advertisement