i am writing an ios game.i use lua to write the game logic.then i try to integrate lua files into ios program.i add the lua files to app resource.when i run the program, an error occur:
LUA_ERRRUN: a runtime error.
...4-489C-4A40-8582-F734FAAC428D/ChemLLK.app/llk_facade.lua:3: module 'lianliankan' not found:
no field package.preload['lianliankan']
no file '/usr/local/share/lua/5.2/lianliankan.lua'
no file '/usr/local/share/lua/5.2/lianliankan/init.lua'
no file '/usr/local/lib/lua/5.2/lianliankan.lua'
no file '/usr/local/lib/lua/5.2/lianliankan/init.lua'
no file './lianliankan.lua'
no file '/usr/local/lib/lua/5.2/lianliankan.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './lianliankan.so'
i wander whether "." in path is equal to the resource folder. and i don't know how to solve this problem. who can help me?
When a script calls require
, it searches a number of preset locations for the script. None of those preset locations are your application resources . Therefore, a script's require
function will never find what it's looking for.
You need to register a handler for require
that will look for the script in your resources.
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.