handle error in lua calls to prevent crashes
recreate canvas image when changing size
expose window width and height as global variables on lua side
implement size() function to set window size
force window size (by default 500x500) and disable resizing