Lua麻烦:尝试调用全局“解压"(nil值) [英] Lua trouble: attempt to call global 'unpack' (a nil value)
本文介绍了Lua麻烦:尝试调用全局“解压"(nil值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Lua相对较新,并且正在尝试将其嵌入到库中.我可以从命令行执行脚本,但是在嵌入脚本时在脚本中调用函数时遇到以下错误
I am relatively new to Lua, and am experimenting with embedding it in a library. I can execute the script just fine from the command line, but I hit the following error when calling a function in my script when embedded
PANIC: unprotected error in call to Lua API ([string "-- #! /usr/local/bin/lua..."]:72: attempt to call global 'unpack' (a nil value))
unpack
去哪里了?
推荐答案
您可能是将Lua嵌入为源代码,而不是预先构建的库.在这种情况下,您可能尚未启用向后兼容.
You're probably embedding Lua as source, not as a pre-built library. In this case, you have probably not enabled backward compatibility.
默认情况下,命令行解释器是向后兼容的,因此您会看到差异.
By default, the command line interpreter is built with backward compatibility, hence the difference you see.
这篇关于Lua麻烦:尝试调用全局“解压"(nil值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文