开发者

Lua and Objective-C: lua_pushlightuserdata() - how shall we handle the userdata object release?

The code snippet:

MyUIView *view = [[MyUIView alloc] initWithFrame:CGRectMake(0,0,100,100)]; 
lua_pushlightuserdata(L, view);

I keep a reference inside Lua for the开发者_Go百科 view object. Shall I release it from Objective-C? Does Lua retain it?


If you want Lua to manage the lifetime of your object, you should use full userdata.

But, even then Lua is in plain C and does not know anything about Objective-C stuff, so it will not retain anything without your help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜