diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-25 02:28:20 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-25 02:28:20 +0000 |
commit | 33fba71fc94b84c33b1e600da9b195eac49b2e31 (patch) | |
tree | 52864fe0b23f64a71f5967efc317ff9f440989a3 /libs | |
parent | 9297ef38c47c4e5dea67e98c794d951cacc2d936 (diff) |
libs/core: make luci.util.spairs(), kspairs() and vspairs() return the sequential index as 3rd variable
Diffstat (limited to 'libs')
-rw-r--r-- | libs/core/luasrc/util.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index e285777c3..da761e219 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -4,9 +4,6 @@ LuCI - Utility library Description: Several common useful Lua functions -FileId: -$Id$ - License: Copyright 2008 Steven Barth <steven@midlink.org> @@ -609,6 +606,7 @@ end function _sortiter( t, f ) local keys = { } + local k, v for k, v in pairs(t) do keys[#keys+1] = k end @@ -620,7 +618,7 @@ function _sortiter( t, f ) return function() _pos = _pos + 1 if _pos <= #keys then - return keys[_pos], t[keys[_pos]] + return keys[_pos], t[keys[_pos]], _pos end end end |