Ijwu
Ijwu

Reputation: 352

" '}' expected near '=' " error appearing in a line that otherwise appears perfect

When I attempt to run my script, I get an error returning on a variable assignment. I've re-checked my syntax many times and it doesn't seem to be a mistake I made there--I even had somebody else look at it just in case. However, the error that returns continuously points me to the syntax, and I can't seem to find a solution to this problem.

Here is the whole troublesome function:

    function registerquestlines()
       if player["testline"] == nil then
            player["testline"] = {"prog" = {true,false,false}, "quests" = {"testline1", "testline2", "testline3"}, "prog#" = 1}
       end
    end

Again, the error I get is: '}' expected near '=' on the line in which I assign values to player["testline"].

Upvotes: 9

Views: 22103

Answers (1)

geekosaur
geekosaur

Reputation: 61369

A table initializer uses either an unquoted name or a bracketed expression, not a quoted name.

{prog = {true,false,false}}
{["prog"] = {true,false,false}}

Upvotes: 12

Related Questions