[Lua][ImageManager] getSingleton is nil

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Just popping in
Just popping in
Posts: 3
Joined: Sun Jul 07, 2013 11:17
Location: Diósd, Hungary

[Lua][ImageManager] getSingleton is nil

Postby Baarnus » Tue Jul 09, 2013 09:20


My problem is, that I want to load an imageset from lua:

Code: Select all


And the error is that the getSingeton function doesn't exist. I get the error:

Code: Select all

terminate called after throwing an instance of 'CEGUI::ScriptException'
  what():  CEGUI::ScriptException in function 'void CEGUI::LuaScriptModule::executeScriptFile_impl(const CEGUI::String&, const CEGUI::String&, int, int)' (/home/baarnus/Dokumentumok/Install/cegui-0.8.2/cegui/src/ScriptModules/Lua/ScriptModule.cpp:590) : Unable to execute Lua script file: 'init_editor.lua'

[string "init_editor.lua"]:10: attempt to call method 'getSingleton' (a nil value)

From C++ the loading works correctly, and other singletons like Logger and AnimationManager are working correctly. The question is, that getSingleton is really missing, or I'm doing something wrong?

My whole lua script:

Code: Select all

-- CEGUI singletons
local logger = CEGUI.Logger:getSingleton()
-- Begin Editor Init
logger:logEvent("++++ Editor init started ++++")
-- Load layout
local layout = CEGUI.WindowManager:getSingleton():loadLayoutFromFile("editor.layout")
-- Set layout
-- Load icons
-- Load animations
Setup the tab control
@param tabControlName
function setupTabControl(tabControlName, iconSet)
   -- Get the tab control for name
   local tabControl = CEGUI.toTabControl(layout:getChild(tabControlName))
   -- Tab buttons
   local tabButtons = tabControl:getChild("__auto_TabPane__Buttons")
   -- For all children
   for i=1,math.min(tabControl:getTabCount(),table.getn(iconSet)) do
      -- Get tab button
      local tabButton = tabButtons:getChildAtIdx(i-1)
      -- Animation
--      tabButton:setProperty("Icon", "EditorIcons/"..iconSet[i])
      logger:logEvent("TabButton: "..tabButton:getText())
      -- Add icon
      logger:logEvent("Button: "..tabButton:getName()..", Icon: "..iconSet[i]..", Anim: "..iconSet[i].."IconAnim")
-- Setup Tab controls
--setupTabControl("View/Tabs", {"Drill","Drill","Drill"})
--setupTabControl("Inventory/Tabs", {"Drill","Engine","Track"})
-- End Editor Init
logger:logEvent("++++ Editor init ended ++++")


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest