--------------------
--lua 创建链表 并打印
list = nil
for line in io.lines() do
list = {
next = list, value = line}
end
local l = list
while l do
print(l.value)
l = l.next
end
---------------------
ployline = {color = "blue", thickness = 2, npoints = 4,
{x = 0, y = 0},
{x = -10, y = 0},
{x = -10, y = 1}
}
print(ployline[2].x)
print(ployline[4].x)
-----------------------
---------------
--cache小例子---
---------------
local test_cache = {}
function set_cache(cache, key, value)
-- body
if cache == nil then
cache = test_cache
end
cache[key] = value
end
function get_cache( cache, ke