1.loadfile---只编译,不运行. loadfile编译代码成中间码并且返回编译后的chunk作为一个函数,而不执行代码:另外loadfile不会抛出错误信息而是返回错误代号. loadstring与loadfile相似,只不过它不是从文件里读入chunk,而是从一个串中读入. 2.dofile----编译.运行. dofile,其实首先是利用loadfile进行编译,然后再运行代码.我们可以定义dofile如下: function dofile (filename) local f =
什么是环境? http://www.lua.org/manual/5.1/manual.html#2.9 Besides metatables, objects of types thread, function, and userdata have another table associated with them, called their environment. Like metatables, environments are regular tables and multiple