==========================example for lua json======================= local cjson = require("cjson") local str = '["a", "b", "c"]' local j = cjson.decode(str) for i,v in ipairs(j) do print(v) end str = '{"A&quo…
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…
类和对象: account.lua module(...,package.seeall) Account={balance=} Account.new=function(self,o) local o=o or {} setmetatable(o,self) self.__index=self return o end Account.getBalance=function(self) return self.balance end Account.setBalance=function(s…