Tip: Control structure too long near

Started by Zefk, October 10, 2016, 06:56:30 AM

Previous topic - Next topic
October 10, 2016, 06:56:30 AM Last Edit: November 03, 2016, 08:28:45 PM by Zefk
This can happen with too many if statements  are nested into one if statement.

Control structure too long near

Too many elseif statements in one if control structure can cause the same error.

Code ( lua) Select
if X then
   -- stuff
elseif Y then
   -- stuff
elseif Z then
   -- stuff
end


Source:
https://forums.wowace.com/showthread.php?t=21768

It can happen with a loop too.

Code ( lua) Select
local b="x=1;"
while true do
        local s="while true do "..b.." end"
        local f,err=loadstring(s)
        print(#b)
        if f==nil then
                print(#b,err)
                break
        end
        b=b..b
end


Source:
http://lua.2524044.n2.nabble.com/Cause-for-quot-control-structure-too-long-quot-td7650425.html

If you reach this kind of limit, there is something really wrong with your code.