Skip to content

Instantly share code, notes, and snippets.

@cmsj
Created February 27, 2022 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmsj/ff64a2267c8017d6447b741848be07da to your computer and use it in GitHub Desktop.
Save cmsj/ff64a2267c8017d6447b741848be07da to your computer and use it in GitHub Desktop.
static int camera_isinuse(lua_State *L) {
LuaSkin *skin = [LuaSkin sharedWithState:L];
[skin checkArgs:LS_TUSERDATA, USERDATA_TAG, LS_TBREAK];
HSCamera *camera = [skin toNSObjectAtIndex:1];
// This was the original code here, crashed every time
// lua_pushboolean(skin.L, camera.isInUse);
// return 1;
// This is the new code here, and even this crashes without NSLog()
NSLog(@"Camera: %@", camera);
NSNumber *isInUse = [NSNumber numberWithBool:camera.isInUse];
[skin pushNSObject:isInUse];
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment