lua的表读取成字符串
针对任意一张表,读取表中所有的数据,并输出
--读取表的规则
function PrintByRule(data)
local str = ""
if type(data) == "table" then
str = str.."{"
local count = 0
for key,value in pairs(data) do
count = count + 1
if type(key) ~= "number" then
str = str..key.."="
elseif key ~= count then
str = str.."["..key