Maniascript::addCodeBeforeMain($code) to insert global code before the main() method