diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2015-03-18 12:44:45 +0800 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-03-26 21:38:14 +0100 |
commit | 06df8218e7036ad9bc03537d8039c6f4728602ac (patch) | |
tree | 08cbc1b6d3c960c7b55dc29c3b5e504fe3f734c6 | |
parent | 54ca5ae34788d4fc6afc10dfbed69517badf5cd8 (diff) | |
download | uci-06df8218e7036ad9bc03537d8039c6f4728602ac.tar.gz |
lua: restore return value of require('uci') to module table.
Before commit "b121dd lua: add lua 5.2 compatibility changes", the
module table was filled by luaL_register() which would leave the table
at the top of the stack. But in current code the module table will be
popped by lua_setglobal() causing the return value defaulting to boolean
value true.
Also fix the return value of luaopen_uci() to 1 to indicate the number
of return value on stack.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r-- | lua/uci.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -994,8 +994,9 @@ luaopen_uci(lua_State *L) /* create module */ lua_newtable(L); + lua_pushvalue(L, -1); luaL_setfuncs(L, uci, 0); lua_setglobal(L, MODNAME); - return 0; + return 1; } |