1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-15 22:57:12 +02:00

Updated the Squirrel and Sqrat libraries to the latest development versions.

This commit is contained in:
Sandu Liviu Catalin
2016-05-22 22:51:59 +03:00
parent 40a2ba46f5
commit 6822172f6a
18 changed files with 283 additions and 219 deletions

View File

@ -281,6 +281,44 @@ public:
#endif
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Checks if the object has a slot with a specified key
///
/// \param key Name of the key
///
/// \return True if the Object has a value associated with key, otherwise false
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(const SQChar* key) const {
sq_pushobject(vm, GetObject());
sq_pushstring(vm, key, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
return false;
}
sq_pop(vm, 2);
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Checks if the object has a slot with a specified index
///
/// \param index Index to check
///
/// \return True if the Object has a value associated with index, otherwise false
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(SQInteger index) const {
sq_pushobject(vm, GetObject());
sq_pushinteger(vm, index);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
return false;
}
sq_pop(vm, 2);
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Casts the object to a certain C++ type
///