📜  lua 代码 - Lua 代码示例

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

代码示例2
-- While the code below IS lua, I think it's a bit hard to understand..-
-- Another way to do it, without confusing yourself, is just doing it like this:

local firstTable = {}

firstTable.Apples = "Apple"
firstTable.Bananas = "Banana" -- I'm adding new variables inside the table by using a dot,
-- Seperating themselves from the table, and the variable!
-- (A variable is something that can be used as a faster way to use values..
-- For instance, printing a string.)

print(firstTable.Apples, firstTable.Bananas)




-- IF YOU WANT TO DO IT FASTER vv


local secondTable = {}

secondTable.Apples = "Apples"
secondTable.Bananas = "Bananas"

local Apples, Bananas = secondTable.Apples, secondTable.Bananas
print(Apples, Bananas)