1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-10-21 10:27:18 +02:00

Minor adjustments to Sqrat types. Improved shared pointers to use less heap allocations for counters.

This commit is contained in:
Sandu Liviu Catalin
2017-02-21 21:19:10 +02:00
parent 6909e46125
commit 178b30bb20
3 changed files with 383 additions and 268 deletions

View File

@@ -147,6 +147,24 @@ public:
sq_pop(vm,1); // pop table
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a Table or Class to the Table (can be used to facilitate namespaces)
///
/// \param name The key in the table being assigned a Table or Class
/// \param obj Table or Class that is being placed in the table
///
/// \remarks
/// Bind cannot be called "inline" like other functions because it introduces order-of-initialization bugs.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQChar* name, LightObj& obj) {
sq_pushobject(vm, GetObject());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, obj.GetObject());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a raw Squirrel closure to the Table
///