📌  相关文章
📜  如何从表中选择一个随机项目 lua 代码示例

📅  最后修改于: 2022-03-11 14:54:54.553000             🧑  作者: Mango

代码示例2
local myTable = {"Hello", "World", "Lua"}

print(myTable[1]) --Outputs: "Hello"
print(#myTable) --Outputs: 3 because we have 3 values in our table
print(myTable[math.random(1, #myTable)]) --Outputs a random value in our table!