| 1016 | } |
| 1017 | |
| 1018 | int asCContext::SetObject(void *obj) |
| 1019 | { |
| 1020 | if( m_status != asEXECUTION_PREPARED ) |
| 1021 | return asCONTEXT_NOT_PREPARED; |
| 1022 | |
| 1023 | if( !m_initialFunction->objectType ) |
| 1024 | { |
| 1025 | m_status = asEXECUTION_ERROR; |
| 1026 | return asERROR; |
| 1027 | } |
| 1028 | |
| 1029 | asASSERT( *(asPWORD*)&m_regs.stackFramePointer[0] == 0 ); |
| 1030 | |
| 1031 | *(asPWORD*)&m_regs.stackFramePointer[0] = (asPWORD)obj; |
| 1032 | |
| 1033 | // TODO: This should be optional by having a flag where the application can chose whether it should be done or not |
| 1034 | // The flag could be named something like takeOwnership and have default value of true |
| 1035 | if( obj && (m_initialFunction->objectType->flags & asOBJ_SCRIPT_OBJECT) ) |
| 1036 | reinterpret_cast<asCScriptObject*>(obj)->AddRef(); |
| 1037 | |
| 1038 | return 0; |
| 1039 | } |
| 1040 | |
| 1041 | int asCContext::SetArgByte(asUINT arg, asBYTE value) |
| 1042 | { |