From 93da237dc09c31ef3c6db462de0845addf8a87f6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 25 Aug 2009 01:42:01 +0200 Subject: [PATCH] lua: add a return code for aborting iteration in uci_foreach --- lua/uci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- 2.11.0