Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jan 2012
Offline Last Active Oct 01 2013 12:04 AM

Posts I've Made

In Topic: Global Variable Initialization Context

16 May 2013 - 07:03 PM

What i mean is you can't add variables to context and make them available to function.

SetUserData is just to associate it some of your own c++ object, just a convenience method.


If you have one module per script file than you should use globals. They are belong to module they are created.

If not use script classes, your c++ class owns a asIScriptObject then you can operate on that.

In Topic: CScriptArray::Destruct

16 May 2013 - 06:58 PM



Ok i am sorry, i just did the math for real this time. You are right. I should have rushed to answer without checking my facts :)


A script object handle has mask of asTYPEID_MASK_OBJECT | asTYPEID_OBJHANDLE

An c++ object handle has mask of asTYPEID_APPOBJECT | asTYPEID_OBJHANDLE


I don't think there is anything wrong with if( subTypeId & asTYPEID_MASK_OBJECT ).

It doesn't care about handles because all handles are asTYPEID_APPOBJECT or asTYPEID_MASK_OBJECT or asTYPEID_TEMPLATE .

There aren't any handle types that doesn't fit those 3. No such thing as pure asTYPEID_OBJHANDLE

In Topic: Global Variable Initialization Context

16 May 2013 - 02:20 PM

Contexts do not have special storage for executing function to access. You should use classes. Associate your C++ objects with script classes then you have what you need.


Get module of the current function.  (wrote this from memory might be a syntax error)

asIScriptModule *mod =  asGetActiveContext()->GetEngine()->GetModule(asGetActiveContext()->GetCurrentFunction()->GetModuleName());

In Topic: Object Handle vs Object reference

16 May 2013 - 02:14 PM

They are very different. You cant assign a reference for example.

Handle is a safe refcounted/garbage collected pointer, ( like shared_ptr in c++ but safer )

Reference is same as reference in c++ but not assignable.


void Func( Object &obj )


   Object &o = obj; // not possible in angelscript


In Topic: CScriptArray::Destruct

16 May 2013 - 02:09 PM

It's a binary mask. You can check its value in angelscript.h.

If a type is asTYPEID_OBJHANDLE then it's a asTYPEID_MASK_OBJECT.