What does ["String"] mean in a module script?

I’m looking at the source code of HD’s admin in order to get the picture of how an admin script is made and as I myself don’t know the first thing about copyright law I’ll just post an example I made:

Module Script

["String"] = {
Function = function(speaker, args)
local val1 = tick()
local returnValue = getPing 
end
}

This is hopefully going to help get my question across, what does the [“string”] do?

4 Likes

[“String”] is the parent of Function. It’s essentially the same thing as:

String = {}

String.Function = -- function

4 Likes

Unrelated but been wondering this for a while, how do I get the ‘programmer’ tag next to my username?

2 Likes
13 Likes

It’s inside a table. It’s just defining a key in a table

local tab = {
    String = function()
        print("something")
    end
}

-- is the same as

local tab = {
    ["String"] = function()
        print("something")
    end
}

-- is the same as

local tab = {}
tab.String = function()
    print("something")
end
13 Likes