I am trying to develop a game by using the c++ with lua, and I am using the quick-cocos2d-x engine to help me finish that. The problem is: I need user to download the lua scripts into their sdcard on their iphone/android devices, so that I can call the function in the downloaded lua scripts, but I am not sure for how to implement that?
What I have done but failed:
Modified the main.lua:
package.path = package.path .. ";src/" to be: package.path = package.path .. ";sdcard/scripts/"
In my lua script(internal), call the downloaded script by using:
local testScene = require("sdcard.scripts.DownloadTestScene") display.replaceScene(testScene.new())
So do anyone know how to make it come true, I have the internal lua script, I just want to call the download lua script, and not sure for how to implement that, thanks for anyone who may help me with this problem.
从C ++,您可以luaL_dofile
使用文件的路径调用luaL_dofile
,然后以通常的方式调用该函数。
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.