projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
38ef0f9
)
* luci/libs: add keys() to luci.util
author
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 17 Aug 2008 14:56:03 +0000
(14:56 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 17 Aug 2008 14:56:03 +0000
(14:56 +0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index ef1b8fe279565d5b33c3a089bdfa0e9d30a284fb..c6d9ec6ce162b622d66cdd6dc84d2814f505e5c0 100644
(file)
--- a/
libs/core/luasrc/util.lua
+++ b/
libs/core/luasrc/util.lua
@@
-358,6
+358,19
@@
function update(t, updates)
end
end
+--- Retrieve all keys of given associative table.
+-- @param t Table to extract keys from
+-- @return Sorted table containing the keys
+function keys(t)
+ local keys = { }
+ if t then
+ for k, _ in kspairs(t) do
+ table.insert( keys, k )
+ end
+ end
+ return keys
+end
+
--- Clones the given object and return it's copy.
-- @param object Table value to clone
-- @param deep Boolean indicating whether to do recursive cloning