Changeset 6670 for code/branches/gamestates2/data
- Timestamp:
- Apr 1, 2010, 1:46:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestates2/data/lua/LuaStateInit.lua
r6665 r6670 16 16 original_dofile = dofile 17 17 dofile = function(filename) 18 luaState:doFile(filename) 18 if not luaState:doFile(filename) then 19 error("Error propagation. Do not display") 20 end 19 21 -- Required because if the file returns a table, it cannot be passed through the C++ function 20 22 return LuaStateReturnValue -- C-injected global variable … … 25 27 -- to a function provided to the LuaState constructor (in C++) 26 28 include = function(filename) 27 luaState:includeFile(filename) 29 if not luaState:includeFile(filename) then 30 error("Error propagation. Do not display") 31 end 28 32 -- Required because if the file returns a table, it cannot be passed through the C++ function 29 33 return LuaStateReturnValue -- C-injected global variable … … 54 58 _REQUIREDNAME = moduleName 55 59 56 luaState:doFile(moduleName .. ".lua") 60 if not luaState:doFile(moduleName .. ".lua") then 61 error("Error propagation. Do not display") 62 end 57 63 -- LuaStateReturnValue is required because if the file returns a table, 58 64 -- it cannot be passed through the C++ function … … 66 72 return asdf 67 73 end 74 75 76 -- Load useful tool functions (like handleDefaultArgument) 77 require("Tools") 68 78 69 79 … … 82 92 -- General error handler that gets called whenever an error happens at runtime 83 93 errorHandler = function(err) 84 -- Display the error message85 94 if type(err) == "string" then 95 -- Simply return if the error has already been handled 96 if string.find(err, "Error propagation. Do not display") ~= nil then 97 return err 98 end 99 -- Display the error message 86 100 logMessage(1, "Lua runtime error: "..err) 87 101 end … … 92 106 else 93 107 -- Fallback: print stack trace 94 logMessage( 1, debug.traceback(2))108 logMessage(3, debug.traceback("")) 95 109 end 96 110 return err -- Hello Lua debugger user! Please type 'set 2' to get to the
Note: See TracChangeset
for help on using the changeset viewer.