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

What's the difference between table = {key = value} and table = {["key"] = value}?

Asked by 5 years ago

I've seen the following:

table = {
    key = value
}
table = {
    ["key"] = value
}

What are the differences?

1 answer

Log in to vote
1
Answered by
RayCurse 1518 Moderation Voter
5 years ago

Absolutely nothing. It’s called syntactic sugar and is meant to make the syntax of a language more clean. The latter example is used when the key has white space, numerical operators, or begins with a number.

1
Syntax sugar is just an alternative way for you to type the same code. It will otherwise function in exactly the same way. Link150 1355 — 5y
Ad

Answer this question