Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

lua

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"].

like image 623
Ijwu Avatar asked Apr 25 '12 23:04

Ijwu


1 Answers

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

{prog = {true,false,false}}
{["prog"] = {true,false,false}}
like image 168
geekosaur Avatar answered Sep 23 '22 14:09

geekosaur