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