when i load lfs module in lua file, i got the error message:
error loading module 'lfs' from file '/usr/lib64/lua/5.1/lfs.so':
/usr/lib64/lua/5.1/lfs.so:1: unexpected symbol near 'char(127)'
here is the code:
#!/usr/bin/lua
package.path = package.path .. ";/usr/lib64/lua/5.1/?.so"
require"lfs"
if i execute the code in lua console, it succeed; if i copy the lfs.so file to the same directory as the lua file, i succeed too. i had googled,but can't find a solution.
You're loading a C library. For C library packages, the path to be used should be package.cpath
.
package.path
(for modules written in Lua) andpackage.cpath
(for modules written in C) are the places where Lua looks for modules. They are semicolon-separated lists, and each entry can have a?
in it that's replaced with the module name.