2016-05-31 06:26:54 +02:00
|
|
|
------------------------------------------------------------
|
|
|
|
-- Copyright (c) 2016 tacigar
|
|
|
|
-- https://github.com/tacigar/maidroid
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
|
|
|
maidroid.util = {}
|
|
|
|
|
2016-06-02 06:18:58 +02:00
|
|
|
-- check that the table has the value
|
2016-05-31 06:26:54 +02:00
|
|
|
function maidroid.util.table_find_value(tbl, value)
|
2016-09-13 02:48:17 +02:00
|
|
|
for k, v in ipairs(tbl) do
|
|
|
|
if v == value then return true, k end
|
|
|
|
end
|
|
|
|
return false, nil
|
2016-05-31 06:26:54 +02:00
|
|
|
end
|
|
|
|
|
2016-06-02 06:18:58 +02:00
|
|
|
-- table shallow copy
|
2016-05-31 06:26:54 +02:00
|
|
|
function maidroid.util.table_shallow_copy(source)
|
2016-09-13 02:48:17 +02:00
|
|
|
local copy = {}
|
|
|
|
for key, value in pairs(source) do
|
|
|
|
copy[key] = value
|
|
|
|
end
|
|
|
|
return copy
|
2016-05-31 06:26:54 +02:00
|
|
|
end
|