错误luaL_doString" '/'"附近的意外符号 [英] Error luaL_doString " unexpected symbol near '/' "

查看:143
本文介绍了错误luaL_doString" '/'"附近的意外符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码关于以下内容时出现了一些错误:

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));

,输出为:

文件:/app_home/data/minigames/mg_hint_machine_2.lua

RET(File):[string"/app_home/data/minigames/mg_hint_machine_2.lua"]:1:/"附近的意外符号

我很确定自己的道路.另外,我不知道什么符号表示意外或

I'm pretty sure about my path. Additionally I don't know what symbol that unexpected or

我想念东西.

推荐答案

您想要的是luaL_dofile而不是luaL_dostring.

luaL_dostring-尝试将字符串作为lua代码执行.

luaL_dostring - tries to execute the string as lua code.

luaL_dofile-尝试执行字符串所指向的文件作为lua代码.

luaL_dofile - tries to execute the file that the string points to as lua code.

这篇关于错误luaL_doString" '/'"附近的意外符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆