🎉 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!

best way to register a property

Started by
2 comments, last by WitchLord 16 years, 8 months ago
Hello, I want to register a c++ class as a global property and it should not be allowed to be constructed in the script, but a reference to an object of this class should be allowed to be passed as a parameter of a function. i.e.:

engine->RegisterObjectType("signal_t", 0, asOBJ_REF | asOBJ_NOHANDLE); 
engine->RegisterGlobalProperty("signal_t my_signal", &my_signal);

...

engine->RegisterObjectMethod("some_other_class_t", "void foo(signal_t ∈)", asFUNCTION(foo_generic), asCALL_GENERIC); 
AS code:

some_other_class_t my_class;
my_class.foo(my_signal);
Should I register an assignment behavior for signal_t or do something else?
Advertisement
also, what is the correct way to return boolean in the maximum portability mode?

I've used SetReturnDWord, it works well with AS 2.8.1, but it works no more for me with AS r205...
It looks like SetReturnByte works nice.
Yes, SetReturnByte is the correct method, since the boolean type is only 1 byte. You can also use GetReturnPointer, e.g:

*(bool*)gen->GetReturnPointer() = true;


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

This topic is closed to new replies.

Advertisement