1

私はこのような状況にあります。問題に進む前に、以下のコードを確認してください(タイトルで適切に説明できませんでした)

私のlua初期化コード:

luaState = luaL_newstate();
luaL_openlibs(luaState);
RegisterFunctions(luaState);

私のluaローディングコード:

try {
        luaL_dofile(luaState, scriptPath.c_str());
    }
    catch (...) {
        std::cout << "LUA ERROR: Could not load file " << std::endl;

    }
    loaded_.push_back(filename);

C関数を定義した部分:

int testFunction(lua_State* L)
{
    std::cout << "Test" << std::endl;
    return 0;
}
void RegisterFunctions(lua_State* L)
{
    lua_register(L, "testFunction", testFunction);

}

私のLuaスクリプト:

test = {};

function test:testCallback(me)
    testFunction();
end

これらのコードは、Androidで正しくビルドおよび実行できます。しかし、testFunction()が呼び出されたとき、私が定義したC関数に入りませんでした。これ以外はすべて機能します。また、IOSとIOSでテストしましたが、testFunctionにも入ります。この問題はAndroidでのみ発生し、途方に暮れています。誰かアドバイスがあれば幸いです。

4

0 に答える 0