lua weak table 经常看到lua表中有 weak table的用法, 例如: weak_table = setmetatable({}, {__mode="v"}) 官网上的解释: http://www.lua.org/pil/17.html Weak tables are the mechanism that you use to tell Lua that a reference should not prevent the reclamation of an obje…
先上代码 function luautil.serialize(t, sort_parent, sort_child) local mark={} local assign={} local function ser_table(tbl,parent) mark[tbl]=parent local tmp={} local sortList = {}; for k,v in pairs(tbl) do sortList[#sortList + 1] = {key=k, value=v}; end…
转载:https://blog.csdn.net/Fenglele_Fans/article/details/83627021 1:table.sort() language = {"lua","java","c#","c++"} table.sort(language) --只有table一个参数,使用lua默认的排序方式排序for i, v in ipairs(language) do -- print(v) --输出c#…