[Orxonox-commit 1949] r6666 - code/branches/gamestates2/data/gui/scripts
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Mar 31 02:37:46 CEST 2010
Author: rgrieder
Date: 2010-03-31 02:37:45 +0200 (Wed, 31 Mar 2010)
New Revision: 6666
Modified:
code/branches/gamestates2/data/gui/scripts/CreditsMenu.lua
code/branches/gamestates2/data/gui/scripts/GUITools.lua
Log:
Fixed problem that can occur when BasicGUI cannot be loaded.
Modified: code/branches/gamestates2/data/gui/scripts/CreditsMenu.lua
===================================================================
--- code/branches/gamestates2/data/gui/scripts/CreditsMenu.lua 2010-03-31 00:36:48 UTC (rev 6665)
+++ code/branches/gamestates2/data/gui/scripts/CreditsMenu.lua 2010-03-31 00:37:45 UTC (rev 6666)
@@ -1,9 +1,6 @@
-- CreditsMenu.lua
-local sheetName = _REQUIREDNAME or "CreditsMenu"
--- Create object of type BasicGUI and make it global
-local P = require("BasicGUI"):new(sheetName)
-_G[sheetName] = P
+local P = createSheet("CreditsMenu")
function P.CreditsBackButton_clicked(e)
hideGUI(P.filename)
Modified: code/branches/gamestates2/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/gamestates2/data/gui/scripts/GUITools.lua 2010-03-31 00:36:48 UTC (rev 6665)
+++ code/branches/gamestates2/data/gui/scripts/GUITools.lua 2010-03-31 00:37:45 UTC (rev 6666)
@@ -1,6 +1,10 @@
function createSheet(sheetName)
-- Create object of type BasicGUI and make it global
- local sheet = require("BasicGUI"):new(sheetName)
+ local basicGUI = require("BasicGUI")
+ if basicGUI == nil then
+ error("Loading BasicGUI.lua failed")
+ end
+ local sheet = basicGUI:new(sheetName)
_G[sheetName] = sheet
return sheet
end
More information about the Orxonox-commit
mailing list