Lua trouble: attempt to call global 'unpack' (a nil value)

六眼飞鱼酱① 提交于 2019-12-12 12:17:17

问题


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))

Where did unpack go?


回答1:


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.



来源:https://stackoverflow.com/questions/25794364/lua-trouble-attempt-to-call-global-unpack-a-nil-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!