mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-30 19:13:53 +01:00
added sets.lua, reordered dofiles in /tables/init.luas
This commit is contained in:
parent
38335e291f
commit
0026bcdab7
@ -10,11 +10,12 @@
|
||||
|
||||
-- TODO: Refactor into its own worldeditadditions.tables namespace.
|
||||
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/sets.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/shallowcopy.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_apply.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_unpack.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_get_last.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_tostring.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_map.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_filter.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_get_last.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_map.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_tostring.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_unique.lua")
|
||||
dofile(worldeditadditions.modpath.."/utils/tables/table_unpack.lua")
|
||||
|
9
worldeditadditions/utils/tables/sets.lua
Normal file
9
worldeditadditions/utils/tables/sets.lua
Normal file
@ -0,0 +1,9 @@
|
||||
--- Creates a table that stores data in keys.
|
||||
-- @source https://riptutorial.com/lua/example/13407/search-for-an-item-in-a-list
|
||||
-- @param list table The table of values to convert to keys.
|
||||
-- @return table The table of (key,true) pairs.
|
||||
function worldeditadditions.makeset (list)
|
||||
local set = {}
|
||||
for _, l in ipairs(list) do set[l] = true end
|
||||
return set
|
||||
end
|
Loading…
Reference in New Issue
Block a user