From: Felix Fietkau Date: Mon, 24 Aug 2009 23:42:01 +0000 (+0200) Subject: lua: add a return code for aborting iteration in uci_foreach X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=93da237dc09c31ef3c6db462de0845addf8a87f6;p=uci.git lua: add a return code for aborting iteration in uci_foreach --- diff --git a/lua/uci.c b/lua/uci.c index 98f1e15..d16a0fd 100644 --- a/lua/uci.c +++ b/lua/uci.c @@ -297,8 +297,11 @@ uci_lua_foreach(lua_State *L) lua_pushvalue(L, 3 + offset); /* iterator function */ uci_push_section(L, s, i - 1); - if (lua_pcall(L, 1, 0, 0) == 0) + if (lua_pcall(L, 1, 1, 0) == 0) { ret = true; + if (lua_isboolean(L, -1) && !lua_toboolean(L, -1)) + break; + } } done: