简体   繁体   中英

Lua iOS Objective-C

I am trying to run some code from some time ago, after recompiling Lua for proper architecture, I am having some issues with the following line.

KillScript* script = (KillScript*)lua_tointeger(L, -1);

I am getting the following error on that line:

Cast of 'lua_integer' (aka'long') to 'KillScript' is disallowed with ARC.

Does anybody know why wouldn't this logic work?

Thanks!!

ARC -- automatic reference counting -- doesn't allow you to move between non-object reference types and object reference types. A lua_integer is a C scalar.

You can do some unsafe casting dance to keep ARC enabled, but I suspect you'll run into other issues.

If it is a standalone project, turn off ARC and try compiling. You'll likely run into other issues-- deprecation, etc... -- but at least you'll probably have relatively sane memory management behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM