为什么80%的码农都做不了架构师?>>>
这两个函数的定义都位于 ldo.c 中,看看这两个函数都做了什么事儿?
先来看一下 lua_dofile 执行文件
复制代码
1
2
3
4
5
6
LUA_API int lua_dofile (lua_State *L, const char *filename) { int status = parse_file(L, filename); if (status == 0) /* parse OK? */ status = lua_call(L, 0, LUA_MULTRET); /* call main */ return status; }
先解析文件,如果解析无误,则调用。
由函数名字及下面的调用我们可以猜出,parse_file 应该是做的语法解析。
复制代码
1
2
3
4
5
6
static int parse_file (lua_State *L, const char *filename) { ZIO z; int status; int bin; /* flag for file mode */ int c; /* look ahead char */ FILE *f = (filename == NU
最后
以上就是迅速西装最近收集整理的关于Lua4.0 lua_dofile,lua_dostring的全部内容,更多相关Lua4.0内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复