some fixes in MainWindow move

This commit is contained in:
Eduardo Bart
2012-02-07 02:55:20 -02:00
parent 876c521d43
commit 37f3f904c7
9 changed files with 29 additions and 5 deletions

View File

@@ -32,6 +32,18 @@ LuaObject::~LuaObject()
releaseLuaFieldsTable();
}
bool LuaObject::hasLuaField(const std::string& field)
{
bool ret = false;
if(m_fieldsTableRef != -1) {
g_lua.getRef(m_fieldsTableRef);
g_lua.getField(field); // push the field value
ret = !g_lua.isNil();
g_lua.pop(2);
}
return ret;
}
void LuaObject::releaseLuaFieldsTable()
{
if(m_fieldsTableRef != -1) {

View File

@@ -40,6 +40,8 @@ public:
template<typename R, typename... T>
R callLuaField(const std::string& field, const T&... args);
bool hasLuaField(const std::string& field);
/// Sets a field in this lua object
template<typename T>
void setLuaField(const std::string& key, const T& value);