lua命令: #enter shell lua #excute script file lua xxx.lua lua脚本: #!/usr/local/bin/lua 核心概念: As a extension language, Lua has no notion of a 'Main’ program: it only works embedded in a host client, called the embedding program or simply the host. The h…
http://lua.2524044.n2.nabble.com/LightUserData-and-metatables-td3807698.html https://www.lua.org/manual/5.3/manual.html#2.4 https://www.lua.org/manual/5.0/manual.html#3.8 "... do you realize that by setting the metatable of a light userdatayou are ac…
闭包 示例一 function newCounter() return function() -- anonymous function i = i + return i end end c1 = newCounter() print(c1()) --> 1 print(c1()) --> 2 示例二 function myPower(x) return function(y) return y^x end end power2 = myPower() power3 = myPower() )…
表据说是LUA的核, 呵呵, 看例子吧, 看上去, 跟java的list很像, 又有点像json: a = {} -- create a table and store its reference in `a' k = "x" a[k] = 10 -- new entry, with key="x" and value=10 a[20] = "great" -- new entry, with key=20 and value="gre…