From a0778877feded62642cb088990353b950daa3bab Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 2 Jan 2025 10:01:47 +0700 Subject: [PATCH] update roadmap --- ROADMAP.md | 3 ++- evolved.lua | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 6115f58..db86606 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -9,4 +9,5 @@ - should we clear chunk's components by on_insert tag callback? - replace id type aliases with separated types to hide implementation details - clear chunk's tables instead reallocating them -- add initializer list to __table_new? +- add REQUIRES fragment trait +- try to keep entity_chunks/places tables as arrays diff --git a/evolved.lua b/evolved.lua index 85e1382..01ef0e4 100644 --- a/evolved.lua +++ b/evolved.lua @@ -130,6 +130,7 @@ local __table_new = (function() ---@param nhash integer ---@return table return table_new_loader and table_new_loader() or function(narray, nhash) + -- we have to check arguments here for consistency with table.new if type(narray) ~= 'number' then error('narray must be a number', 2) end if type(nhash) ~= 'number' then error('nhash must be a number', 2) end return {} @@ -141,6 +142,7 @@ local __table_clear = (function() local table_clear_loader = package.preload['table.clear'] ---@param tab table return table_clear_loader and table_clear_loader() or function(tab) + -- we have to check arguments here for consistency with table.clear if type(tab) ~= 'table' then error('tab must be a table', 2) end for i = #tab, 1, -1 do tab[i] = nil end for k in pairs(tab) do tab[k] = nil end @@ -237,12 +239,6 @@ end --- --- -local __TABLE_POOL_TAG__BYTECODE = 1 -local __TABLE_POOL_TAG__CHUNK_LIST = 2 -local __TABLE_POOL_TAG__EACH_STATE = 3 -local __TABLE_POOL_TAG__EXECUTE_STATE = 4 -local __TABLE_POOL_TAG__FRAGMENT_LIST = 5 - ---@alias evolved.table_pool_tag ---| `__TABLE_POOL_TAG__BYTECODE` ---| `__TABLE_POOL_TAG__CHUNK_LIST` @@ -250,6 +246,12 @@ local __TABLE_POOL_TAG__FRAGMENT_LIST = 5 ---| `__TABLE_POOL_TAG__EXECUTE_STATE` ---| `__TABLE_POOL_TAG__FRAGMENT_LIST` +local __TABLE_POOL_TAG__BYTECODE = 1 +local __TABLE_POOL_TAG__CHUNK_LIST = 2 +local __TABLE_POOL_TAG__EACH_STATE = 3 +local __TABLE_POOL_TAG__EXECUTE_STATE = 4 +local __TABLE_POOL_TAG__FRAGMENT_LIST = 5 + ---@type table local __tagged_table_pools = __table_new(5, 0)