Problem with LUA not having acces to CEGUI objects.

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

jtracy
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Dec 20, 2006 17:20

Problem with LUA not having acces to CEGUI objects.

Postby jtracy » Wed Jan 03, 2007 23:12

I am just trying to get a simple demo working where I have a button that I create in a layout and have it call a LUA function when clicked. The problem is that I cannot access anything in CEGUI through LUA. I get the following error when trying to execute a script that tries to log something.

script:
function luabtn_clicked(e)
local we = CEGUI.toWindowEventArgs(e)
we.window:setText("handled from Lua");
end
local logger = CEGUI.Logger:getSingleton()
logger:logEvent( ">>> Init script says hello" )

error:
03/01/2007 18:04:57 (Error) Exception: Unable to execute Lua script file: 'scripts/script.lua'

[string "scripts/Login.lua"]:6: attempt to index global `CEGUI' (a nil value)

03/01/2007 18:04:57 (Error) Exception: System::executeScriptFile - An exception was thrown during the execution of the script file.

I think it is something simple that I am missing, but I cannot figure out what is causing the problem.

User avatar
Trentin
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Tue Nov 22, 2005 21:25
Contact:

Postby Trentin » Thu Jan 04, 2007 03:30

The only thing I can think of is are you creating the LuaScriptModule? I create it just before I create the CEGUI::System object.

Code: Select all

pGUIScriptModule = new CEGUI::LuaScriptModule(...);
pGUISystem = new CEGUI::System(...);


Maybe that'll help...

jtracy
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Dec 20, 2006 17:20

Postby jtracy » Thu Jan 04, 2007 15:07

I was creating the LuaScriptModule, but because I was using delta3D I had to get creative and find a way to pass that in on the creating of the System which ofcourse did not work. It does work however if I use the setScriptingModule method. Thanks for the help.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 18 guests