1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Object to typename helper.

This commit is contained in:
Sandu Liviu Catalin 2022-10-03 18:32:06 +03:00
parent e29070af49
commit 78dc76e6b4
2 changed files with 13 additions and 0 deletions

View File

@ -248,6 +248,14 @@ String SqTypeName(HSQUIRRELVM vm, SQInteger idx)
return String(val.mPtr, static_cast< size_t >(val.mLen)); return String(val.mPtr, static_cast< size_t >(val.mLen));
} }
// ------------------------------------------------------------------------------------------------
String SqTypeName(HSQUIRRELVM vm, LightObj & obj)
{
const StackGuard sg(vm);
sq_pushobject(vm, obj);
return SqTypeName(vm, -1);
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LightObj BufferToStrObj(const Buffer & b) LightObj BufferToStrObj(const Buffer & b)
{ {

View File

@ -242,6 +242,11 @@ SQMOD_NODISCARD const SQChar * SqTypeName(SQObjectType type);
*/ */
SQMOD_NODISCARD String SqTypeName(HSQUIRRELVM vm, SQInteger idx); SQMOD_NODISCARD String SqTypeName(HSQUIRRELVM vm, SQInteger idx);
/* ------------------------------------------------------------------------------------------------
* Retrieve the string representation of a certain type from a script object.
*/
SQMOD_NODISCARD String SqTypeName(HSQUIRRELVM vm, LightObj & obj);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Create a script string instance from a buffer. * Create a script string instance from a buffer.
*/ */