修复错误显示

This commit is contained in:
baidwwy 2021-02-23 16:17:07 +08:00
parent c4e0d4394f
commit 9ed94611a3
2 changed files with 9 additions and 14 deletions

View File

@ -1,7 +1,7 @@
--[[
@Author : baidwwy
@Date : 2020-09-22 19:49:01
@LastEditTime : 2021-02-22 21:41:08
@LastEditTime : 2021-02-23 16:03:24
--]]
io.stdout:setvbuf('no',0)
@ -144,12 +144,8 @@ end
-- return nil
-- end
if not gge.isdebug then
local success, res = pcall(require, entry)
if not success then
error(res,0)
end
return res
local success, res = assert(pcall(require, entry))
if not success then
error(res,0)
end
return require(entry)
return res

View File

@ -67,11 +67,10 @@ static int GGE_Load(lua_State *L)
static int GGE_Error(lua_State* L) {
lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);//LOADED
if (lua_getfield(L,-1,"SDL")!= LUA_TTABLE){
lua_pop(L, 2);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "error", lua_tostring(L, -1), NULL);
}else
printf("%s\n",lua_tostring(L,-1));
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "error", lua_tostring(L, -3), NULL);
}else{
printf("%s\n", lua_tostring(L, -3));
}
return 0;
}