1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

"Noob" question: what is a "chunk has too many syntax levels" error?

Discussion in 'Civ5 - SDK / LUA' started by crake, May 25, 2014.

  1. crake

    crake Chieftain

    Joined:
    Dec 8, 2013
    Messages:
    15
    my code I am using for a scenario (which I have correctly set to load within Modbuddy) fails to have an effect in-game. In FireTuner I am told that the cause of this is a "chunk has too many syntax levels" in line 739, specifically: as someone new (very new) to lua, what exactly does this mean? How can I fix it?
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,426
    Location:
    Near Portsmouth, UK
    Google is your friend - http://wiki.roblox.com/index.php/Lua_errors

    Specifically, "chunk has too many syntax levels"

    This is caused by doing too many operations at once.
    It can result from:
    Too many operations (e.g. Doing 500 concatenations in a single expression)
    Too many nested control statements (Loops, if statements, etc)

    So as you're not doing operations it MUST be the control statements.

    Re-check the syntax if the Lua if statement, it is not "if condition then statement(s)" but "if condition then statement(s) end"

    Your code is missing several hundred ends
     
  3. crake

    crake Chieftain

    Joined:
    Dec 8, 2013
    Messages:
    15
    Thanks; I've followed your advice and the code is now working - granted, the game crashes on a specific AI's turn immediately following the player's turn, but the code works and has an effect in-game. It seems I still have much to learn.
     
  4. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Modbuddy should have made that error clear to you (by the editor not identifying your code blocks). It won't tell you if your code "works", of course, but it will at least tell you if you are missing ends and other similar syntax errors.
     

Share This Page