[Orxonox-commit 1906] r6623 - in code/branches/gamestate/data: gui/scripts lua

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Mar 27 17:48:35 CET 2010


Author: rgrieder
Date: 2010-03-27 17:48:34 +0100 (Sat, 27 Mar 2010)
New Revision: 6623

Modified:
   code/branches/gamestate/data/gui/scripts/GameplayMenu.lua
   code/branches/gamestate/data/gui/scripts/GraphicsMenu.lua
   code/branches/gamestate/data/gui/scripts/SettingsMenu.lua
   code/branches/gamestate/data/lua/LuaStateInit.lua
Log:
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)

Modified: code/branches/gamestate/data/gui/scripts/GameplayMenu.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/GameplayMenu.lua	2010-03-27 16:39:26 UTC (rev 6622)
+++ code/branches/gamestate/data/gui/scripts/GameplayMenu.lua	2010-03-27 16:48:34 UTC (rev 6623)
@@ -17,22 +17,22 @@
 
 function P.GameplayThemeCombobox_changed(e)
     -- theme
-    debug("event: theme")
+    logMessage(0, "event: theme")
 end
 
 function P.GameplayDifficultyEasyButton_clicked(e)
     -- difficulty easy
-    debug("event: easy")
+    logMessage(0, "event: easy")
 end
 
 function P.GameplayDifficultyNormalButton_clicked(e)
     -- difficulty normal
-    debug("event: normal")
+    logMessage(0, "event: normal")
 end
 
 function P.GameplayDifficultyHardButton_clicked(e)
     -- difficulty hard
-    debug("event: hard")
+    logMessage(0, "event: hard")
 end
 
 function P.GameplayBackButton_clicked(e)

Modified: code/branches/gamestate/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/GraphicsMenu.lua	2010-03-27 16:39:26 UTC (rev 6622)
+++ code/branches/gamestate/data/gui/scripts/GraphicsMenu.lua	2010-03-27 16:48:34 UTC (rev 6623)
@@ -142,7 +142,7 @@
 function P.GraphicsBrightnessScrollbar_changed(e)
     if scrollbar_active == false then
         -- brightness
-        debug("event: brightness")
+        logMessage(0, "event: brightness")
     end
 end
 
@@ -152,7 +152,7 @@
 
 function P.GraphicsBrightnessScrollbar_ended(e)
     -- brightness
-    debug("event: brightness")
+    logMessage(0, "event: brightness")
     scrollbar_active = false
 end
 

Modified: code/branches/gamestate/data/gui/scripts/SettingsMenu.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/SettingsMenu.lua	2010-03-27 16:39:26 UTC (rev 6622)
+++ code/branches/gamestate/data/gui/scripts/SettingsMenu.lua	2010-03-27 16:48:34 UTC (rev 6623)
@@ -24,7 +24,7 @@
 
 function P.SettingsResetSettingsButton_clicked(e)
     -- reset settings
-    debug("event: reset settings")
+    logMessage(0, "event: reset settings")
 end
 
 function P.SettingsBackButton_clicked(e)

Modified: code/branches/gamestate/data/lua/LuaStateInit.lua
===================================================================
--- code/branches/gamestate/data/lua/LuaStateInit.lua	2010-03-27 16:39:26 UTC (rev 6622)
+++ code/branches/gamestate/data/lua/LuaStateInit.lua	2010-03-27 16:48:34 UTC (rev 6623)
@@ -1,9 +1,7 @@
 -- Note: luaState is a pointer to the LuaState instance that created this lua state
 
--- Save original print function in debug
-debug = print
-
 -- Redirect print to the C++ print function
+original_print = print
 print = function(s)
   luaState:luaPrint(s)
 end
@@ -12,15 +10,16 @@
 logMessage = function(level, message)
   luaState:luaLog(level, message)
 end
+cout = logMessage
 
 -- Redirect dofile in order to load with the resource manager
-doFile = function(filename)
+original_dofile = dofile
+dofile = function(filename)
   luaState:doFile(filename)
   -- Required because the C++ function cannot return whatever might be on the stack
   return LuaStateReturnValue -- C-injected global variable
 end
-original_dofile = dofile
-dofile = doFile
+doFile = dofile
 
 -- Create includeFile function that preparses the file according
 -- to a function provided to the LuaState constructor (in C++)
@@ -33,9 +32,10 @@
 -- Replace require function with almost similar behaviour
 -- The loaded modules are then stored with their names (where name has no .lua extension)
 -- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file
-old_require = require
+original_require = require
 require = function(moduleName)
   if not luaState:fileExists(moduleName .. ".lua") then
+    logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
     return nil
   end
   if not _LOADED then




More information about the Orxonox-commit mailing list