change lua_error to on_error