public void PushUtopiaLogLevel(RealStatePtr L, Utopia.LogLevel val) { if (UtopiaLogLevel_TypeID == -1) { bool is_first; UtopiaLogLevel_TypeID = getTypeId(L, typeof(Utopia.LogLevel), out is_first); if (UtopiaLogLevel_EnumRef == -1) { Utils.LoadCSTable(L, typeof(Utopia.LogLevel)); UtopiaLogLevel_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX); } } if (LuaAPI.xlua_tryget_cachedud(L, (int)val, UtopiaLogLevel_EnumRef) == 1) { return; } IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, UtopiaLogLevel_TypeID); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail fail for Utopia.LogLevel ,value=" + val); } LuaAPI.lua_getref(L, UtopiaLogLevel_EnumRef); LuaAPI.lua_pushvalue(L, -2); LuaAPI.xlua_rawseti(L, -2, (int)val); LuaAPI.lua_pop(L, 1); }
public void UpdateUtopiaLogLevel(RealStatePtr L, int index, Utopia.LogLevel val) { if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UtopiaLogLevel_TypeID) { throw new Exception("invalid userdata for Utopia.LogLevel"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail for Utopia.LogLevel ,value=" + val); } } else { throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index)); } }
public void Get(RealStatePtr L, int index, out Utopia.LogLevel val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UtopiaLogLevel_TypeID) { throw new Exception("invalid userdata for Utopia.LogLevel"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); int e; if (!CopyByValue.UnPack(buff, 0, out e)) { throw new Exception("unpack fail for Utopia.LogLevel"); } val = (Utopia.LogLevel)e; } else { val = (Utopia.LogLevel)objectCasters.GetCaster(typeof(Utopia.LogLevel))(L, index, null); } }