mirror of
https://github.com/tacigar/maidroid.git
synced 2024-11-15 23:00:20 +01:00
24 lines
599 B
Lua
24 lines
599 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
|