void LuaValue::setReference(LuaReference ref) { this->_reference = ref; if (isValid()) { this->_reference->pushValue(); _luaState = ref->getState(); this->_luaType = luaToEnumType(lua_type(_luaState, -1)); lua_pop(_luaState, 1); } }
void LuaFunction::setReference(LuaReference ref) { ref->pushValue(); lua_State* L = ref->getState(); if (lua_type(L, -1) != LUA_TFUNCTION) { lua_pop(L, 1); throw LuaException("Reference does not refere to a function!"); } else { lua_pop(L, 1); LuaValue::setReference(ref); } }
void LuaTable::setReference(const LuaReference& ref) { ref->pushValue(); lua_State* L = ref->getState(); if (lua_type(L, -1) != LUA_TTABLE) { lua_pop(L, 1); throw LuaException("Reference does not refere to a table!"); } else { lua_pop(L, 1); LuaValue::setReference(ref); } }