简体   繁体   中英

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

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?

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.

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