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