⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace-globals.lua

📁 这个是脚本引擎lua的例程,这是一个嵌入式的袖珍引擎
💻 LUA
字号:
-- trace assigments to global variablesdo -- a tostring that quotes strings. note the use of the original tostring. local _tostring=tostring local tostring=function(a)  if type(a)=="string" then   return string.format("%q",a)  else   return _tostring(a)  end end local log=function (name,old,new)  local t=debug.getinfo(3,"Sl")  local line=t.currentline  io.write(t.short_src)  if line>=0 then io.write(":",line) end  io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n") end local g={} local set=function (t,name,value)  log(name,g[name],value)  g[name]=value end setmetatable(getfenv(),{__index=g,__newindex=set})end-- an examplea=1b=2a=10b=20b=nilb=200print(a,b,c)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -