Fix splitting functions that have joined lines
Fix bailout condition for detection lua function
Match lua function end only on empty line and trim
Add lua table splitting and joining
Add spec and fixes