1
0
mirror of https://github.com/tacigar/maidroid.git synced 2024-11-16 23:30:21 +01:00
maidroid/util.lua
2016-09-13 09:48:17 +09:00

24 lines
566 B
Lua

------------------------------------------------------------
-- Copyright (c) 2016 tacigar
-- https://github.com/tacigar/maidroid
------------------------------------------------------------
maidroid.util = {}
-- check that the table has the value
function maidroid.util.table_find_value(tbl, value)
for k, v in ipairs(tbl) do
if v == value then return true, k end
end
return false, nil
end
-- table shallow copy
function maidroid.util.table_shallow_copy(source)
local copy = {}
for key, value in pairs(source) do
copy[key] = value
end
return copy
end