CAI
unread,Feb 9, 2012, 1:27:19 AM2/9/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iPhone Wax
lua_State *L = wax_currentLuaState();
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,
YES);
const char *file = [[[paths objectAtIndex:0]
stringByAppendingPathComponent:@"main.lua"] UTF8String] ;
int a = luaL_dofile(L,file);
if(a != 0){
printf("%s\n", lua_tostring(L, -1));
}else{
lua_getglobal(L, "_view"); // _view =
UILabel:initWithFrame(....)
lua_getglobal(L, "_str");
UILabel *luaView = (UILabel*)lua_touserdata(L, -2);
char *str = lua_tostring(L, -1);
printf("%s\n", str); // good
[self.view addSubview:luaView];// EXC_BAD_ACCESS appears here.
}
If I miss something when using Lua this way?