From 8e0fa68e5bf99424e80af644820593c3efa3474f Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Wed, 28 Oct 2009 20:02:53 +0100 Subject: [PATCH] fix function require --- src/lib/luapackage.pir | 8 ++++++-- t/lua-TestMore | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/luapackage.pir b/src/lib/luapackage.pir index 07bb74a..c800b7c 100644 --- a/src/lib/luapackage.pir +++ b/src/lib/luapackage.pir @@ -472,12 +472,16 @@ any loader for the module, then C signals an error. new $P0, 'LuaNil' $P0 = $P1(modname) # run loaded module $I0 = isa $P0, 'LuaNil' - unless $I0 goto L7 + if $I0 goto L7 + _LOADED[modname] = $P0 + L7: + $P0 = _LOADED[modname] + unless $P0 == sentinel goto L8 # use true as result new $P0, 'LuaBoolean' set $P0, 1 - L7: _LOADED[modname] = $P0 + L8: .return ($P0) .end diff --git a/t/lua-TestMore b/t/lua-TestMore index b73dcd6..bba3436 160000 --- a/t/lua-TestMore +++ b/t/lua-TestMore @@ -1 +1 @@ -Subproject commit b73dcd6582fc0d3fa82b722447bce5ea7dcbf191 +Subproject commit bba3436291930ab5b5eac52f40990b32c174b49c