From f7956d97e2e3071718cff9562b86d332b48e6570 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 4 Apr 2018 18:39:06 +0100 Subject: [PATCH] Add default_def for trigger prototype --- api.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 74a784e..d7d11e3 100644 --- a/api.lua +++ b/api.lua @@ -52,7 +52,9 @@ function awards.player_or_nil(name) return awards.players[name] end -local function run_trigger_callbacks(self, player, data, table_func) +local default_def = {} + +function default_def:run_callbacks(player, data, table_func) for i = 1, #self.on do local res = nil local entry = self.on[i] @@ -73,7 +75,9 @@ function awards.register_trigger(tname, tdef) "Passing a callback to register_trigger is not supported in 3.0") tdef.name = tname - tdef.run_callbacks = run_trigger_callbacks + for key, value in pairs(default_def) do + tdef[key] = value + end if tdef.type == "counted" then local old_reg = tdef.on_register