extract multiple lua scripts from main loop