Lua实现链表

--定义链表储存结构
list = nil;
list = {next = next,value = https://www.it610.com/article/v};

local l = list;

--初始化一个链表
for i = 1,10 do
l.value = https://www.it610.com/article/i;
l = {next = l,value=https://www.it610.com/article/i};
end;

--输出链表
local list_out = l;
while list_out do
print(list_out.value);
list_out = list_out.next;
end;
【Lua实现链表】转载于:https://blog.51cto.com/wujuxiang/423903

    推荐阅读