Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 27, 2010, 5:48:34 PM (14 years ago)
Author:
rgrieder
Message:

The lua "print" function was previously stored in "debug" —> changed that to "original_print".
Please use logMessage(level, message)
or its shortcut cout(level, message)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/data/lua/LuaStateInit.lua

    r6432 r6623  
    11-- Note: luaState is a pointer to the LuaState instance that created this lua state
    22
    3 -- Save original print function in debug
    4 debug = print
    5 
    63-- Redirect print to the C++ print function
     4original_print = print
    75print = function(s)
    86  luaState:luaPrint(s)
     
    1311  luaState:luaLog(level, message)
    1412end
     13cout = logMessage
    1514
    1615-- Redirect dofile in order to load with the resource manager
    17 doFile = function(filename)
     16original_dofile = dofile
     17dofile = function(filename)
    1818  luaState:doFile(filename)
    1919  -- Required because the C++ function cannot return whatever might be on the stack
    2020  return LuaStateReturnValue -- C-injected global variable
    2121end
    22 original_dofile = dofile
    23 dofile = doFile
     22doFile = dofile
    2423
    2524-- Create includeFile function that preparses the file according
     
    3433-- The loaded modules are then stored with their names (where name has no .lua extension)
    3534-- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file
    36 old_require = require
     35original_require = require
    3736require = function(moduleName)
    3837  if not luaState:fileExists(moduleName .. ".lua") then
     38    logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
    3939    return nil
    4040  end
Note: See TracChangeset for help on using the changeset viewer.