Lua string转table

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/A13155283231/article/details/89284206

可以自己写个函数实现一下

ss = '{[1]={["discount"]=10000,["id"]=1},\
	   [2]={["discount"]=1041,["id"]=2}, \
	   [3]={["discount"]=5558,["id"]=3}}';

local tab = loadstring("return " .. ss);

print(tab()[1].discount);

猜你喜欢

转载自blog.csdn.net/A13155283231/article/details/89284206