Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea complains about syntax and won't run my app.

edited August 2014 in Questions Posts: 6

Codea won't let me run my app due to invalid syntax. One thing it is complaining about is this, in my main file:

setup = AppManager.initialize

draw = DrawingManager.drawFrame

In a file called AppManager, I have a table called AppManager that does in fact have a function called initialize in it. However, the syntax checker doesn't seem to like function references like this, and responds with "attempt to index global AppManager (a nil value)". There is also a file called DrawingManager with a table called DrawingManager with a drawFrame function inside of it, but that doesn't seem to be a problem for the syntax checker.

Another thing it complains about is this:

DebugManager = {
    Log = {
        appendToLog = function(data)
            table.insert(log, {["type"] = "normal", ["data"] = data, ["time"] = os.date("!%c")})
            print(log[table.maxn(log)].time.." : "..log[table.maxn(log)].data)
        end
        appendWarningToLog = function(data)
            table.insert(log, {["type"] = "warning", ["data"] = data, ["time"] = os.date("!%c")})
            print(log[table.maxn(log)].time.." : "..log[table.maxn(log)].data)
        end
    }

}

It says that I am not closing the curly brace of the Log table (though this one may be my fault, may have missed a bracket somewhere. This syntax checker is just bothering me, it won't let me play my app. Can I disable it?

Tagged:

Comments

  • Posts: 1,976

    Could you post the full code? It's hard to figure it out from bits and pieces, and the lines it says cause the errors actually might not be the problem.

    For you first problem, though, in the editor, try dragging the Main tab's button (drag the lines next to it) to the far right.

  • IgnatzIgnatz Mod
    Posts: 5,396

    @Codea_User - I can quite easily see a missing curly bracket at the end of the Log table

    Even if you could (you can't), there's no point disabling the syntax checker, because your program won't run if there are errors.

    I'm not clear why you're trying to replace the standard setup function - and if you are, I don't believe that's the way to do it. I think you have to use debug.hook, but someone like @Briarfox knows more about that than me. But I would first make sure this is really what you need to do.

  • Posts: 2,043

    @Ignatz that missing curly brace is just not in the syntax highlight it is right below. The problem is he didn't put a comma in between the entries in the table.

Sign In or Register to comment.