Compare commits
3 Commits
bc5dc6b2b4
...
8f03c6473b
Author | SHA1 | Date |
---|---|---|
Starbeamrainbowlabs | 8f03c6473b | |
Starbeamrainbowlabs | bdaedf0e7a | |
Starbeamrainbowlabs | 38a72468d9 |
|
@ -1,7 +1,7 @@
|
|||
_G.worldeditadditions_core = {
|
||||
split = require("worldeditadditions_core.utils.strings.split"),
|
||||
table = {
|
||||
contains = require("worldeditadditions_core.utils.tables.table_contains")
|
||||
contains = require("worldeditadditions_core.utils.table.table_contains")
|
||||
}
|
||||
}
|
||||
local parse_map = require("worldeditadditions_core.utils.parse.map")
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
local makeset = require("worldeditadditions_core.utils.table.makeset")
|
||||
|
||||
describe("table.makeset", function()
|
||||
it("should work with a single item", function()
|
||||
local result = makeset({ "apples" })
|
||||
assert.are.same(
|
||||
{ apples = true },
|
||||
result
|
||||
)
|
||||
end)
|
||||
it("should work with 2 items", function()
|
||||
local result = makeset({ "apples", "orange" })
|
||||
assert.are.same(
|
||||
{ apples = true, orange = true },
|
||||
result
|
||||
)
|
||||
end)
|
||||
it("should work with duplicate items", function()
|
||||
local result = makeset({ "apples", "apples" })
|
||||
assert.are.same(
|
||||
{ apples = true },
|
||||
result
|
||||
)
|
||||
end)
|
||||
it("should work with duplicate items and non-duplicate items", function()
|
||||
local result = makeset({ "apples", "oranges", "apples" })
|
||||
assert.are.same(
|
||||
{ apples = true, oranges = true },
|
||||
result
|
||||
)
|
||||
end)
|
||||
end)
|
|
@ -44,7 +44,7 @@ wea_c.terrain = dofile(wea_c.modpath.."/utils/terrain/init.lua")
|
|||
dofile(wea_c.modpath.."/utils/strings/init.lua")
|
||||
dofile(wea_c.modpath.."/utils/format/init.lua")
|
||||
dofile(wea_c.modpath.."/utils/parse/init.lua")
|
||||
dofile(wea_c.modpath.."/utils/tables/init.lua")
|
||||
dofile(wea_c.modpath.."/utils/table/init.lua")
|
||||
|
||||
dofile(wea_c.modpath.."/utils/numbers.lua")
|
||||
dofile(wea_c.modpath.."/utils/nodes.lua")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- worldeditadditions_core = { modpath="/home/sbrl/.minetest/worlds/Mod-Sandbox/worldmods/WorldEditAdditions/worldeditadditions_core/" }
|
||||
local wea_c = worldeditadditions_core
|
||||
local table_map = dofile(wea_c.modpath.."/utils/tables/table_map.lua")
|
||||
local table_map = dofile(wea_c.modpath.."/utils/table/table_map.lua")
|
||||
|
||||
local function is_whitespace(char)
|
||||
return char:match("%s")
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
-- ████████ █████ ██████ ██ ███████ ███████
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ███████ ██████ ██ █████ ███████
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██ ██████ ███████ ███████ ███████
|
||||
|
||||
-- Functions that operate on tables.
|
||||
-- Lua doesn't exactly come with batteries included, so this is quite an
|
||||
-- extensive collection of functions :P
|
||||
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
wea_c.table = {
|
||||
apply = dofile(wea_c.modpath.."/utils/table/table_apply.lua"),
|
||||
contains = dofile(wea_c.modpath.."/utils/table/table_contains.lua"),
|
||||
deepcopy = dofile(wea_c.modpath.."/utils/table/deepcopy.lua"),
|
||||
filter = dofile(wea_c.modpath.."/utils/table/table_filter.lua"),
|
||||
get_last = dofile(wea_c.modpath.."/utils/table/table_get_last.lua"),
|
||||
makeset = dofile(wea_c.modpath.."/utils/table/makeset.lua"),
|
||||
map = dofile(wea_c.modpath.."/utils/table/table_map.lua"),
|
||||
shallowcopy = dofile(wea_c.modpath.."/utils/table/shallowcopy.lua"),
|
||||
tostring = dofile(wea_c.modpath.."/utils/table/table_tostring.lua"),
|
||||
unique = dofile(wea_c.modpath.."/utils/table/table_unique.lua"),
|
||||
unpack = dofile(wea_c.modpath.."/utils/table/table_unpack.lua"),
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
local wea_c = worldeditadditions_core
|
||||
|
||||
local table_unpack = dofile(wea_c.modpath.."/utils/tables/table_unpack.lua")
|
||||
local table_unpack = dofile(wea_c.modpath.."/utils/table/table_unpack.lua")
|
||||
|
||||
|
||||
--- Returns only the last count items in a given numerical table-based list.
|
|
@ -1,25 +0,0 @@
|
|||
-- ████████ █████ ██████ ██ ███████ ███████
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ███████ ██████ ██ █████ ███████
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██ ██████ ███████ ███████ ███████
|
||||
|
||||
-- Functions that operate on tables.
|
||||
-- Lua doesn't exactly come with batteries included, so this is quite an
|
||||
-- extensive collection of functions :P
|
||||
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
wea_c.table = {
|
||||
apply = dofile(wea_c.modpath.."/utils/tables/table_apply.lua"),
|
||||
contains = dofile(wea_c.modpath.."/utils/tables/table_contains.lua"),
|
||||
deepcopy = dofile(wea_c.modpath.."/utils/tables/deepcopy.lua"),
|
||||
filter = dofile(wea_c.modpath.."/utils/tables/table_filter.lua"),
|
||||
get_last = dofile(wea_c.modpath.."/utils/tables/table_get_last.lua"),
|
||||
makeset = dofile(wea_c.modpath.."/utils/tables/makeset.lua"),
|
||||
map = dofile(wea_c.modpath.."/utils/tables/table_map.lua"),
|
||||
shallowcopy = dofile(wea_c.modpath.."/utils/tables/shallowcopy.lua"),
|
||||
tostring = dofile(wea_c.modpath.."/utils/tables/table_tostring.lua"),
|
||||
unique = dofile(wea_c.modpath.."/utils/tables/table_unique.lua"),
|
||||
unpack = dofile(wea_c.modpath.."/utils/tables/table_unpack.lua"),
|
||||
}
|
Loading…
Reference in New Issue