Moved lua utility functions into their own source file.