Setting the global LUA_PATH variable from C++/C?

前端 未结 7 548
说谎
说谎 2020-12-28 09:58

I\'m trying to set my global LUA_PATH variable directly from C/C++, I\'m using Lua from my iPhone applications, so my path tends does change between applications ( each iPho

7条回答
  •  渐次进展
    2020-12-28 10:24

    I'm not too familiar with iPhone development, but can you set the LUA_PATH env variable before executing your application?

    For example, in Linux, I could write a script that executes your binary like so:

    export LUA_PATH="foo"
    /path/to/executable
    

    Windows has similar functionality with batch files.

    If you really need to change it in code, I don't know how to do that short of using luaL_loadbuffer and lua_pcall to execute a "package.path = blah" command.

提交回复
热议问题