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

How do you get values inside values?

Asked by
Bloxks 30
10 years ago

So, if I have a JSON value like:

local whatever = {
    local something = nil;
};

Then how would you get "something" inside "whatever"?

1 answer

Log in to vote
3
Answered by 10 years ago

Iterate through the table.

local whatever = {
    something = "Hello!",
    nothing = "Nothing here!"
}

for i, v in pairs(whatever) do --iterate through the table
    print(v)
end
0
How would you get one value and not all the values? Bloxks 30 — 10y
0
You can access the 'something' like this: print(whatever.something) ForeverDev 155 — 10y
0
Thanks! Bloxks 30 — 10y
Ad

Answer this question