Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
路亚 5.3
这不起作用,为什么?为什么短调用表格不适用于表格?
t = { "a", "b", "c" } s = t:concat()
这行得通...
s = table.concat(t)
该string库将其函数导出到所有字符串共享的元表。这就是为什么你可以使用str:upper()like string.upper(str)。
string
str:upper()
string.upper(str)
table图书馆的情况并非如此。您必须手动设置元表。例如,这有效:
table
local t = { "a", "b", "c" } t.__index = table setmetatable(t, t) local s = t:concat() print(s) -- abc