Add some helper functions to script.c/.h