Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function PRINT_ERROR_TO_CS2D_CONSOLE(ERROR:String)
- Print "Lua Error: " + Error
- EndFunction
- Function lua_traceback:Int(L:Byte Ptr)
- If Not lua_isstring(L, 1) Then
- Return 1
- EndIf
- lua_getfield(L, LUA_GLOBALSINDEX, "debug")
- If Not lua_istable(L, -1) Then
- lua_pop(L, 1)
- PRINT_ERROR_TO_CS2D_CONSOLE(lua_tostring(L, -1))
- Return 1
- EndIf
- lua_getfield(L, -1, "traceback")
- If Not lua_isfunction(L, -1) Then
- lua_pop(L, 2)
- PRINT_ERROR_TO_CS2D_CONSOLE(lua_tostring(L, -1))
- Return 1
- EndIf
- lua_pushvalue(L, 1)
- lua_pushinteger(L, 2)
- lua_call(L, 2, 1)
- PRINT_ERROR_TO_CS2D_CONSOLE(lua_tostring(L, -1))
- Return 1
- EndFunction
- Function luaL_dofile2:Int(L:Byte Ptr, Path:String)
- lua_pushcfunction(L, lua_traceback)
- luaL_loadfile(L, Path)
- Return lua_pcall(L, 0, 0, lua_gettop(L) - 1)
- EndFunction
- Function lua_pcall2:Int(L:Byte Ptr, nargs:Int, nresults:Int)
- lua_pushcfunction(L, lua_traceback)
- lua_pcall(L, nargs, nresults, 0)
- Return lua_pcall(L, 0, 0, lua_gettop(L) - 1)
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement