Board Thread:Lua Help/@comment-26912683-20151114233635/@comment-166269-20151115001102

No max size as far as I know, though there are limits to memory usage (10MB by default IIRC) and execution time (30 seconds, again IIRC). However, there are features and behaviors of the Lua parser that haven't been backported to Wikia from WMF, which some modules on Wikipedia rely on. It's unlikely that this is what's causing the internal error, but is something you should be aware of regardless, hence why I mentioned it.

Given it's an internal error, it's unlikely anyone here will actually be able to help fix it; your best bet would be to file a ticket with staff.