Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need a key in table tostringed how do i do this?

Asked by 4 years ago

local Table = {xd = 'Billionaire',A = 'ADMINS', O = 'ON THIS WEBSITE', I= 'IS', }

I need xd to be a string

I need to turn the keys of the table to a string

for example "xd" "A", "O"

I want them to be turned into string does anyone know how

0
Of all the questions on this site, this one stumped me mybituploads 304 — 4y
0
Whats the usage of it? mybituploads 304 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

They are already strings.

t.a is the same as t["a"] and t.a = b is the same as t["a"] = b. The . notation is just syntactic sugar for the [""] notation, and it makes our lives easier when needing to read from a key, or write to one.

I don't know why you want this, but this can work

local keys = {}

for k in pairs(Table) do
    table.insert(keys, k)
end

print(table.concat(", ", keys))
Ad

Answer this question