扫码关注官方订阅号
如题。我一开始把写好的lua文件拖到项目里,编译完以后查看应用程序包里也有这个文件。在程序里我用“lua文件名”直接取的,但是程序跑起来以后就提示找不到文件。是哪里出了问题么?
欢迎选择我的课程,让我们一起见证您的进步~~
用[[NSBundle mainBundle] resourcePath]获取res目录 然后再前面加入该路径即可,比如:
NSString* filepath=[NSString stringWithFormat:@"%@/%s",[[NSBundle mainBundle] resourcePath], luafilename]; luaL_dofile(filepath);
作为资源文件添加就可以了。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
用[[NSBundle mainBundle] resourcePath]获取res目录
然后再前面加入该路径即可,比如:
NSString* filepath=[NSString stringWithFormat:@"%@/%s",[[NSBundle mainBundle] resourcePath], luafilename];
luaL_dofile(filepath);
作为资源文件添加就可以了。