Exemplo n.º 1
0
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);
	}
}
Exemplo n.º 2
0
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);
	}
}
Exemplo n.º 3
0
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);
	}
}