I got some error when my code is about:
const char* file = "/app_home/data/minigames/mg_hint_machine_2.lua";
PRINTF("File : %s\n", file);
luaL_dostring(LS, file);
PRINTF("RET(File) : %s\n", lua_tostring(LS,-1));
and output is :
File : /app_home/data/minigames/mg_hint_machine_2.lua
RET(File) : [string "/app_home/data/minigames/mg_hint_machine_2.lua"]:1: unexpected symbol near '/'
I'm pretty sure about my path. Additionally I don't know what symbol that unexpected or
I miss something.
You want luaL_dofile
instead of luaL_dostring
.
luaL_dostring
- tries to execute the string as lua code.
luaL_dofile
- tries to execute the file that the string points to as lua code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.