25 lines
448 B
Lua
25 lines
448 B
Lua
|
function auForEach(table, cb, ...)
|
||
|
if (not table) then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if type(table) == "table" then
|
||
|
for k, v in pairs(table) do
|
||
|
cb(v, ...)
|
||
|
end
|
||
|
else
|
||
|
cb(table, ...)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function auForEachKV(table, cb, ...)
|
||
|
if (not table) then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if type(table) == "table" then
|
||
|
for k, v in pairs(table) do
|
||
|
cb(k, v, ...)
|
||
|
end
|
||
|
end
|
||
|
end
|