gpt4 book ai didi

syntax - 是否可以从 luaL_loadstring 等获取有关语法错误发生位置的更多信息?

转载 作者:行者123 更新时间:2023-12-02 21:52:16 24 4
gpt4 key购买 nike

luaL_loadstring 根据文档返回是否存在语法错误(如果有的话)。

有没有办法确定 Lua 首先确定存在语法错误的位置,或者除了返回值表明存在语法错误之外还有其他信息吗?

最佳答案

luaL_loadstring来电 lua_load进行实际工作,请参阅手册:

Loads a Lua chunk (without running it). If there are no errors, lua_load pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message.

所以你可以检查luaL_loadstring的返回值,如果返回错误,请检查堆栈中是否有错误消息。

关于syntax - 是否可以从 luaL_loadstring 等获取有关语法错误发生位置的更多信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18374466/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com