event-hook: rewrite the hook priorities enum
Hooks need to have a priority relative to the event they are executed on, so it does not make much sense to have all kinds of different priorities based also on the event type and/or the module where they are defined. Also, it wouldn't be acceptable to have such an enumeration on the public API.
This commit is contained in:

committed by
Julian Bouzas

parent
e2b9cb0b5e
commit
24db3fe24a
@@ -1875,11 +1875,8 @@ simple_event_hook_new (lua_State *L)
|
||||
priority_type = lua_gettable (L, 1);
|
||||
if (priority_type == LUA_TNUMBER)
|
||||
priority = lua_tointeger (L, -1);
|
||||
else if (priority_type == LUA_TSTRING)
|
||||
priority = wplua_lua_to_enum (L, -1,
|
||||
WP_TYPE_EVENT_HOOK_DEFAULT_PRIORITY_TYPE);
|
||||
else
|
||||
luaL_error (L, "SimpleEventHook: expected 'priority' as number or string");
|
||||
luaL_error (L, "SimpleEventHook: expected 'priority' as number");
|
||||
lua_pop (L, 1);
|
||||
|
||||
lua_pushliteral (L, "type");
|
||||
@@ -2061,11 +2058,8 @@ async_event_hook_new (lua_State *L)
|
||||
priority_type = lua_gettable(L, 1);
|
||||
if (priority_type == LUA_TNUMBER)
|
||||
priority = lua_tointeger (L, -1);
|
||||
else if (priority_type == LUA_TSTRING)
|
||||
priority = wplua_lua_to_enum(L, -1,
|
||||
WP_TYPE_EVENT_HOOK_DEFAULT_PRIORITY_TYPE);
|
||||
else
|
||||
luaL_error(L, "AsyncEventHook: expected 'priority' as number or string");
|
||||
luaL_error(L, "AsyncEventHook: expected 'priority' as number");
|
||||
lua_pop (L, 1);
|
||||
|
||||
lua_pushliteral (L, "type");
|
||||
|
Reference in New Issue
Block a user