xlua學習過程遇到的問題,以後通了之後可能就不是問題了。但是還是有記錄的必要。
//2.加載lua文件,這裏這種方式只能夠加載Resources文件夾下面的,並且是lua.txt類型的文件,感覺沒啥亂用。
//文檔你說的是Resources文件夾下面的才需要加txt後綴,那麽就是說當前文件夾下面的不需要。但是實驗得出的是找不到模塊。什麽鬼?
luaEnv.DoString("require(‘testloadfile‘)");
luaEnv.DoString("require(‘testloadfile2‘)");
LuaException: [string "chunk"]:1: module ‘testloadfile2‘ not found:
no field package.preload[‘testloadfile2‘]
no such builtin lib ‘testloadfile2‘
no such file ‘testloadfile2‘ in CustomLoaders!
no such resource ‘testloadfile2.lua‘
no file ‘D:\Program Files\Unity\Editor\lua\testloadfile2.lua‘
no file ‘D:\Program Files\Unity\Editor\lua\testloadfile2\init.lua‘
no file ‘D:\Program Files\Unity\Editor\testloadfile2.lua‘
no file ‘D:\Program Files\Unity\Editor\testloadfile2\init.lua‘
no file ‘D:\Program Files\Unity\Editor\..\share\lua\5.3\testloadfile2.lua‘
no file ‘D:\Program Files\Unity\Editor\..\share\lua\5.3\testloadfile2\init.lua‘
no file ‘.\testloadfile2.lua‘
no file ‘.\testloadfile2\init.lua‘
no file ‘D:\Program Files\Unity\Editor\testloadfile2.dll‘
no file ‘D:\Program Files\Unity\Editor\..\lib\lua\5.3\testloadfile2.dll‘
no file ‘D:\Program Files\Unity\Editor\loadall.dll‘
no file ‘.\testloadfile2.dll‘
no such file ‘testloadfile2.lua‘ in streamingAssetsPath!
stack traceback:
[C]: in function ‘require‘
[string "chunk"]:1: in main chunk
XLua.LuaEnv.ThrowExceptionFromError (Int32 oldTop) (at Assets/XLua/Src/LuaEnv.cs:429)
XLua.LuaEnv.DoString (System.Byte[] chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:262)
XLua.LuaEnv.DoString (System.String chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:276)
ToDoTest.Start () (at Assets/XLua/Tutorial/TODOTest/ToDoTest.cs:19)
xlua學習過程遇到的問題,以後通了之後可能就不是問題了。但是還是有記錄的必要。