Skip to main content
GameDev.net gamedev.net
🔒 Locked

Passing script struct without 'any' type?

Started by e c h o Sep 30, 2005 at 3:22 AM 1 replies 1.3k views
Original Post
e c h o
e c h o
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.
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
e c h o
e c h o
Alright
thnx for the reply
admit nothing, deny everything and make counter accusations.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.