From d9a964d639050aec69c999891598be94663a2aef Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 26 Dec 2024 15:45:58 +0700 Subject: [PATCH] construct call with fragment --- develop/untests.lua | 4 ++-- evolved.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/develop/untests.lua b/develop/untests.lua index 18b6a93..2edd925 100644 --- a/develop/untests.lua +++ b/develop/untests.lua @@ -345,8 +345,8 @@ end do local f1, f2, f3, f4, f5 = evo.id(5) - evo.set(f1, evo.CONSTRUCT, function(_, a, b) return a - b end) - evo.set(f2, evo.CONSTRUCT, function(_, c) return c end) + evo.set(f1, evo.CONSTRUCT, function(_, _, a, b) return a - b end) + evo.set(f2, evo.CONSTRUCT, function(_, _, c) return c end) evo.set(f3, evo.CONSTRUCT, function() return nil end) evo.set(f4, evo.CONSTRUCT, function() return false end) evo.set(f5, evo.CONSTRUCT, function(e) return e end) diff --git a/evolved.lua b/evolved.lua index 64838e1..e63823f 100644 --- a/evolved.lua +++ b/evolved.lua @@ -166,7 +166,7 @@ evolved.EXCLUDE_LIST = __acquire_id() ---@return evolved.component local function __construct(entity, fragment, component, ...) local default, construct = evolved.get(fragment, evolved.DEFAULT, evolved.CONSTRUCT) - if construct ~= nil then component = construct(entity, component, ...) end + if construct ~= nil then component = construct(entity, fragment, component, ...) end if component == nil then component = default end return component == nil and true or component end