Page 1 of 1

CEGUI Lua error

Posted: Wed Mar 01, 2006 19:46
by hkroger
I get this error when I try to use CEGUI from Lua:

../data/packages/123-123/editor.lua:1: error in function 'new'.
argument #1 is 'class CEGUI::Size'; 'CEGUI::MCLGridRef' expected.

The code which gives this is:

local sizeeee = CEGUI.Size(1,0.1);

Is this some problem with tolua used in CEGUI? How can this be fixed?

Re: CEGUI Lua error

Posted: Wed Mar 01, 2006 19:54
by hkroger
hkroger wrote:I get this error when I try to use CEGUI from Lua:

../data/packages/123-123/editor.lua:1: error in function 'new'.
argument #1 is 'class CEGUI::Size'; 'CEGUI::MCLGridRef' expected.

The code which gives this is:

local sizeeee = CEGUI.Size(1,0.1);

Is this some problem with tolua used in CEGUI? How can this be fixed?


It should be like this instead:
local sizeeee = CEGUI.Size:new(1,0.1);

Therefore the example in code snippets is not functional.

Posted: Wed Mar 01, 2006 20:07
by lindquist
you assign to a local variable so you'll probably want to use new_local (allow garbage collection).

If you don't free it manually you're causing memory leaks.

Anyway, I know I have upgraded the tolua++ to a version that fixes this problem, it might just have made it to CVS head though...

Posted: Wed Mar 01, 2006 20:22
by hkroger
lindquist wrote:you assign to a local variable so you'll probably want to use new_local (allow garbage collection).

If you don't free it manually you're causing memory leaks.


Actually, I do, thanks.

lindquist wrote:Anyway, I know I have upgraded the tolua++ to a version that fixes this problem, it might just have made it to CVS head though...


Can you be more spesific on the actual problem?

Posted: Wed Mar 01, 2006 20:38
by lindquist
It's a bug in tolua++ which was fixed in 1.0.6

Fixed class constructor bug (it is now possible to use 'ClassName()' to create a lua-owned instance of the class without problems)


http://www.codenix.com/~tolua/