Cocos2d-x使用编译的Lua脚本在Android上不能正常工作。

我一直在尝试在Android上让HelloLua示例正常工作。如果hello.lua没有使用luac编译,则可以运行。但如果我编译hello.lua并将其上传到我的Android手机中,它只会给我一个黑屏。有人能帮我吗?

这是AppDelegate :: applicationDidFinishLaunching()中的代码

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
    if (pstrFileContent)
    {
        pEngine->executeString(pstrFileContent->getCString());
    }
#else
    std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
    pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
    pEngine->executeScriptFile(path_c_str());
#endif

似乎当我在Windows中运行时,编译的lua可以工作,但在Android中不能。

点赞
用户107090
用户107090

luac手册页面指出: "预编译块在不同架构之间不可移植"。

2013-04-02 12:23:13