Page cover

👤Tables

If you want to index a table with a key you know, index it with a dot.

local playerData = {name = 'Test'}
local function getPlayerName()
    return playerData.name
end

If the key can variate use []

local playerData = {name = 'Test', age = 31}
local function getPlayerData(key)
    return playerData[key]
end

Last updated