Changeset 6623 for code/branches/gamestate/data/lua
- Timestamp:
- Mar 27, 2010, 5:48:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestate/data/lua/LuaStateInit.lua
r6432 r6623 1 1 -- Note: luaState is a pointer to the LuaState instance that created this lua state 2 2 3 -- Save original print function in debug4 debug = print5 6 3 -- Redirect print to the C++ print function 4 original_print = print 7 5 print = function(s) 8 6 luaState:luaPrint(s) … … 13 11 luaState:luaLog(level, message) 14 12 end 13 cout = logMessage 15 14 16 15 -- Redirect dofile in order to load with the resource manager 17 doFile = function(filename) 16 original_dofile = dofile 17 dofile = function(filename) 18 18 luaState:doFile(filename) 19 19 -- Required because the C++ function cannot return whatever might be on the stack 20 20 return LuaStateReturnValue -- C-injected global variable 21 21 end 22 original_dofile = dofile 23 dofile = doFile 22 doFile = dofile 24 23 25 24 -- Create includeFile function that preparses the file according … … 34 33 -- The loaded modules are then stored with their names (where name has no .lua extension) 35 34 -- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file 36 o ld_require = require35 original_require = require 37 36 require = function(moduleName) 38 37 if not luaState:fileExists(moduleName .. ".lua") then 38 logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ") 39 39 return nil 40 40 end
Note: See TracChangeset
for help on using the changeset viewer.