--first
local test = {};
print(test);
--second
local test_1 = {[1] = 1,[2] = 2};
print(test_1[1]);
print(test_1[2]);
--third
local test_2 = {
{x = 1,y = 2},
{x = 3,y = 10}
};
print(test_2[1].x);
--fourth
function test()
print("Hello Table");
end
local a = {[test] = test()}
--print(a[test]);
Lua table 的几种创建方式。
最新推荐文章于 2022-04-18 09:03:16 发布