Fixes loop to support 0-arg variation

- Previously running `engine.loop()` without a function arg would cause an error.