mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-04-25 21:57:12 +02:00
Implement another constructor for Sqrat's Object type to grab an object reference right from the stack.
This commit is contained in:
parent
1bf80d76c6
commit
5d4f920007
@ -105,6 +105,21 @@ public:
|
|||||||
sq_addref(vm, &obj);
|
sq_addref(vm, &obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Constructs an Object from a Squirrel object at a certain index on the stack
|
||||||
|
///
|
||||||
|
/// \param i Index of the Squirrel object on stack
|
||||||
|
/// \param v VM that the object will exist in
|
||||||
|
///
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Object(SQInteger i, HSQUIRRELVM v = DefaultVM::Get()) : vm(v), release(true) {
|
||||||
|
if (SQ_FAILED(sq_getstackobj(vm, i, &obj))) {
|
||||||
|
sq_resetobject(&obj);
|
||||||
|
} else {
|
||||||
|
sq_addref(vm, &obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructs an Object from a C++ instance
|
/// Constructs an Object from a C++ instance
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user