lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks Waldemar,

I do not know why, but Lua frees some strange places in memory when I pass it with takeownership.

I switched to passing my position array with a simple lua table. I will use pushuserdata only for big classes.

Danilo

2009/11/9 Waldemar Celes <celes@inf.puc-rio.br>
The object is pushed as (heavy) Lua userdata. This means that Lua
keeps a reference to the C object. If you want, you can ask tolua
(through the 'takeownership' function) to delete the C object whenever
Lua collects the corresponding userdata.

-- Waldemar


On Nov 9, 2009, at 2:05 PM, zweifel wrote:

Hello guys,

I would like to know how exactly the memory management in tolua_pushusertype() works. I was expecting that my information was passed as tables to my lua script and that would be I could without problems delete my structs in C. But that does not hold truth, because after deleting the data in C the scripts stopped working.

I looked also that tolua uses a begin_module() to define the classes, but I am not sure how this works either and I was not able to find it on the net.

Could you provide me some information in how does this work or where to obtain information.

Thanks,
Danilo