當試圖在OSX上加載Lua模塊時,我收到以下錯誤。OSX加載dylib Lua模塊
lua: level1.lua:1: module 'libexpand_luaLib' not found:
no field package.preload['libexpand_luaLib']
no file './libexpand_luaLib.lua'
no file '/opt/local/share/lua/5.1/libexpand_luaLib.lua'
no file '/opt/local/share/lua/5.1/libexpand_luaLib/init.lua'
no file '/opt/local/lib/lua/5.1/libexpand_luaLib.lua'
no file '/opt/local/lib/lua/5.1/libexpand_luaLib/init.lua'
no file './libexpand_luaLib.so'
no file '/opt/local/lib/lua/5.1/libexpand_luaLib.so'
no file '/opt/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
level1.lua:1: in main chunk
[C]: ?
lua解釋器試圖加載.so文件而不是.dylib文件。我的印象是,.dylib是.so的OSX等效(稍有變化)。所以我期望Lua解釋器正在尋找一個.dylib文件。
我應該試圖在OSX上將我的庫編譯爲.so嗎?(或者我應該改變與lua解釋器相關的東西?