我知道這是一個很奇怪的問題, 但說我有這種類型的字符串字符串表
local string_1 = "{ [name] = "string_1", [color] = "red" }"
local string_2 = "{ [name] = "string_2", [color] = "blue" }"
local string_3 = "{ [name] = "string_3", [color] = "green" }"
我可以用table.insert什麼使他們成爲這個
local table_1 = {
{ [name] = "string_1", [color] = "red" };
{ [name] = "string_2", [color] = "blue" };
{ [name] = "string_3", [color] = "green" };
}
我認爲琴絃實際上是像' 「{[名] = \」 STRING_1 \ 「[顏色] = \」 紅\「}」'? – 2013-03-25 21:39:17
另外,你的意思是讓鍵是變量'name'和'color'的引用,而不是字符串'name'和'color'? – 2013-03-25 21:43:34