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

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?
 
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
 
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

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.
 
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.
 
Top Bottom