can not use class in tolua++,crash at lua_close()

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
kidcdf
Just popping in
Just popping in
Posts: 6
Joined: Thu Apr 03, 2008 11:31
Location: 中国

can not use class in tolua++,crash at lua_close()

Postby kidcdf » Sat Apr 05, 2008 08:51

in tolua++ 1.0.92 samples,"tclass",I make the pkg "tclassbind.cpp" and compile successfully,everything is ok when it runs to the luaL_dofile(L,"tclass.lua") but the app crashed at lua_close(), heap may be crashed because of "tclass.exe" or the Dlls it used.

if I remove "tolua_tclass_open(L)" ,not to register my class to lua,everything is right. Why?

I have tried to set up a new simple class,but the result is the same.

//by the way: I want to ask the CEGUI author a question why you chose tolua++ not luabind or luaWrapper as the script, we have to write pkg and lua files by ourselves when we use lua,it seems a little inconvenient

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: can not use class in tolua++,crash at lua_close()

Postby CrazyEddie » Sat Apr 05, 2008 10:03

I'm not sure about the issue. Are you using our version of tolua++? Our version is slightly modified, and I'm not sure what happens if you use both that and the 'official' release together at the same time.

kidcdf wrote://by the way: I want to ask the CEGUI author a question why you chose tolua++ not luabind or luaWrapper as the script, we have to write pkg and lua files by ourselves when we use lua,it seems a little inconvenient


Back in the day, when I first did what were essentially tech demos / tests for CEGUI Mk-2 the scripting support was in fact done via luabind. As I recall some of the intermediate output generated by this were huge, and as such there were issues compiling on the systems we supported at the time. In addition to this it would take forever to compile, and many were not happy about the reliance on boost.

Lindquist's scripting module implemented using tolua++ was really compact, flexible, reasonably easy to maintain and control, and so was adopted as the official Lua based scripting module.

I've never heard of luaWrapper.

Don't forget that you are free to create a scripting module using whichever system you desire - the one we supply can be considered as just an example.

CE.

User avatar
kidcdf
Just popping in
Just popping in
Posts: 6
Joined: Thu Apr 03, 2008 11:31
Location: 中国

Re: can not use class in tolua++,crash at lua_close()

Postby kidcdf » Sat Apr 05, 2008 12:43

CrazyEddie wrote:I'm not sure about the issue. Are you using our version of tolua++? Our version is slightly modified, and I'm not sure what happens if you use both that and the 'official' release together at the same time.

kidcdf wrote://by the way: I want to ask the CEGUI author a question why you chose tolua++ not luabind or luaWrapper as the script, we have to write pkg and lua files by ourselves when we use lua,it seems a little inconvenient


Back in the day, when I first did what were essentially tech demos / tests for CEGUI Mk-2 the scripting support was in fact done via luabind. As I recall some of the intermediate output generated by this were huge, and as such there were issues compiling on the systems we supported at the time. In addition to this it would take forever to compile, and many were not happy about the reliance on boost.

Lindquist's scripting module implemented using tolua++ was really compact, flexible, reasonably easy to maintain and control, and so was adopted as the official Lua based scripting module.

I've never heard of luaWrapper.

Don't forget that you are free to create a scripting module using whichever system you desire - the one we supply can be considered as just an example.

CE.


thank u.
Can you take one minute to try the "tclass" sample in tolua++ tests directory? I have sent email to tolua++'s author,for there is no forum or wiki for tolua++ to get help from.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Apr 05, 2008 14:03

I've looked at the files for the test. I do not understand what you are trying to do here. I do not understand how this relates to CEGUI.

Please post some relevant information; exactly what you're trying to do, how you have structured your code, what you expected to happen, and how what actually happens differs from what you were expecting.

CE.

User avatar
kidcdf
Just popping in
Just popping in
Posts: 6
Joined: Thu Apr 03, 2008 11:31
Location: 中国

Postby kidcdf » Sun Apr 06, 2008 05:33

CrazyEddie wrote:I've looked at the files for the test. I do not understand what you are trying to do here. I do not understand how this relates to CEGUI.

Please post some relevant information; exactly what you're trying to do, how you have structured your code, what you expected to happen, and how what actually happens differs from what you were expecting.

CE.


I am sorry to make you confused.
Now I can easily use ceguilua to accomplish cegui scripts function without learning tolua++. But I am not satisfied with it,I want to use ogre objects in lua,too,and why not continue to use tolua++? So I began to study tolua++ in order to use ogre in lua. yeah,I just ask the tolua++ questions here because there is no tolua++ forum and wiki.

I have changed the tolua++ sdk which cegui used, but the problem is the same. If I remove"lua_close(L)" in the end ,everthing is allright,and the lua script can be normally executed. someone told that maybe the lua object is deleted twice, but the following codes also failed:

//tolua++1.0.92 & lua 5.12 sdk
lua_State* L = lua_open();
luaL_openlibs(L);
tolua_open(L);
lua_close(L); //heap is destoryed,the app crashes

debug info:
HEAP[Kid.exe]: Invalid Address specified to RtlValidateHeap( 00480000, 003F5C10 )


Isn't it ridiculous??

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sun Apr 06, 2008 09:42

A short while ago someone i know encountered the same issue, because of different lua versions between Cegui and his own app. But it seems that you are including and linking to the same one lua version, aren't you?

His errors matched yours alot...

Maybe you can double-check? Maybe some old lua stuff on your path settings or in Visual Studio?

HTH.
Check out my released snake game using Cegui!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests