better error handling for lua scripts, fleshed out the lua script example