Well, given that the second example is the one you should be using, and that's the one with the square brackets…
As for
why they're needed, it comes down to context.
Again, when you build a table like this:
local fuelList = {"minecraft:coal", "minecraft:coal_block"}
… since
you aren't specifying index names, Lua automatically assigns "minecraft:coal" to index 1, and "minecraft:coal_block" to index 2. These are simple strings that're going to be assigned as value, so they merely need quotes around them and that's that.
When you build a table like this:
local fuelList = {["minecraft:coal"] = true, ["minecraft:coal_block"] = true}
… you
are defining the names - there's a key called "minecraft:coal", and there's a key called "minecraft:coal_block", and they both have the
value of true.
Normally, when constructing a table this way, you don't need the quotes. You can do this:
local myTable = { someKey = someValue }
You can't do that with minecraft:coal, because of the colon. Lua sees that and assumes you're about to call a function from within a table (as that's what the symbol is used for within the language - it's a shorthand technique that passes the table itself as the first arugment to the function)..
But it you merely wrap it in quotes (to indicate that you're referring to a single string), then Lua's going to assume you're trying to add a string to the table (as in the first example). When you stick an equals after it it'll get confused, assume you made a mistake, and error out.
So, if you're going to use a key name with funny characters, you resort to wrapping square brackets around it. Quote it if it's a string, leave it unquoted if it's a number.