|
|
1
20
在C++中:
我还没有测试或编译它。我用过: http://lua.org/pil http://lua.org/manual/5.1 |
|
|
2
4
ObjC:从另一个答案来看,这是对我有效的。加上“/?.lua“是必需的。 int setLuaPath( NSString* path )
{
lua_getglobal( L, "package" );
lua_getfield( L, -1, "path" ); // get field "path" from table at top of stack (-1)
NSString * cur_path = [NSString stringWithUTF8String:lua_tostring( L, -1 )]; // grab path string from top of stack
cur_path = [cur_path stringByAppendingString:@";"]; // do your path magic here
cur_path = [cur_path stringByAppendingString:path];
cur_path = [cur_path stringByAppendingString:@"/?.lua"];
lua_pop( L, 1 ); // get rid of the string on the stack we just pushed on line 5
lua_pushstring( L, [cur_path UTF8String]); // push the new one
lua_setfield( L, -2, "path" ); // set the field "path" in table at -2 with value at top of stack
lua_pop( L, 1 ); // get rid of package table from top of stack
return 0; // all done!
}
... add this code somewhere, near where you lua_open() for example
// Set Lua's Package.path to where our Lua files can be found
NSString *luaPath = [[NSBundle mainBundle] pathForResource:@"name of any one of my lua files" ofType:@"lua"];
setLuaPath([luaPath stringByDeletingLastPathComponent]);
...
|
|
3
3
|
|
|
4
3
通过执行两个lual_dostring函数,可以很容易地在c++中设置LUA_PATH和LUA_CPATH。
我花了几个小时才找到这个解决办法。。我希望有帮助。 |
|
|
5
0
...
|
|
|
6
0
我想这是不可能的,因为,正如你所见,出于安全原因,每个iPhone应用程序都生活在自己的沙盒中。
我想用
顺便说一句:如果计划将你的应用程序提交给AppStore,(据我所知),脚本语言/解释器将根据你签署的合同进行修改。 |
|
|
7
-1
我不太熟悉iPhone的开发,但是在执行应用程序之前可以设置LUA_PATH env变量吗?
Windows具有与批处理文件类似的功能。
|
|
|
MaPo · Linux,设置锁定ICMP_过滤器选项 1 年前 |
|
Doohyeon Won · 内联函数上的奇怪现象?[关闭] 1 年前 |
|
|
Bobby · 复合字面值总是左值吗? 1 年前 |
|
9-Pin · C: 嵌套结构的堆栈内存分配 1 年前 |