//----------------------------------------------------------------//
bool MOAILuaObject::PushMemberTable ( MOAILuaState& state ) {

	int top = state.GetTop ();

	if ( this->PushLuaUserdata ( state )) {
		if ( lua_getmetatable ( state, -1 )) {
			lua_replace ( state, -2 );
			if ( lua_getmetatable ( state, -1 )) {
				lua_replace ( state, -2 );
				return true;
			}
		}
	}
	state.SetTop ( top );
	lua_pushnil ( state );
	return false;
}
Esempio n. 2
0
//----------------------------------------------------------------//
bool MOAILuaObject::PushMemberTable ( MOAILuaState& state ) {

	MOAILuaClass* luaType = this->GetLuaClass ();
	if ( luaType->IsSingleton ()) {
		this->PushLuaClassTable ( state );
		return true;
	}

	int top = state.GetTop ();

	if ( this->PushLuaUserdata ( state )) {
		if ( lua_getmetatable ( state, -1 )) {
			lua_replace ( state, -2 );
			if ( lua_getmetatable ( state, -1 )) {
				lua_replace ( state, -2 );
				return true;
			}
		}
	}
	state.SetTop ( top );
	lua_pushnil ( state );
	return false;
}