繁体   English   中英

使用已编译的Lua脚本的Cocos2d-x在Android上不起作用

[英]Cocos2d-x using compiled lua script doesn't work on Android

我一直在尝试使HelloLua示例在Android中工作。 如果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中运行但在Android中不运行时,似乎编译过的lua可以工作。

luac手册页中说:“预编译的块不能跨不同的体系结构移植”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM