简体   繁体   English

Lua iOS Objective-C

[英]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. 我试图从前一段时间运行一些代码,在重新编译Lua以获得正确的体系结构之后,以下行出现了一些问题。

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. ARC(自动引用计数)不允许您在非对象引用类型和对象引用类型之间切换。 A lua_integer is a C scalar. lua_integer是C标量。

You can do some unsafe casting dance to keep ARC enabled, but I suspect you'll run into other issues. 您可以进行一些不安全的强制转换,以保持ARC启用状态,但我怀疑您还会遇到其他问题。

If it is a standalone project, turn off ARC and try compiling. 如果是独立项目,请关闭ARC并尝试进行编译。 You'll likely run into other issues-- deprecation, etc... -- but at least you'll probably have relatively sane memory management behavior. 您可能会遇到其他问题-弃用等...-但至少您可能会拥有相对理智的内存管理行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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