【发布时间】:2020-02-20 06:26:35
【问题描述】:
我有一个字符串需要读取为表格
notes = "0,5,10,16"
所以如果我需要当前音符的第三个值,即 10
value = notes[3]
【问题讨论】:
-
这有效lua-users.org/wiki/SplitJoin:函数字符串:split(sep) 本地 sep,字段 = sep 或 ":",{} 本地模式 = string.format("([^%s]+) ", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end testAsTable = notes.split(notes, ',')