summaryrefslogtreecommitdiff
path: root/sys/modules/lua/lua.c
diff options
context:
space:
mode:
authormbalmer <mbalmer@NetBSD.org>2017-05-20 09:46:17 +0000
committermbalmer <mbalmer@NetBSD.org>2017-05-20 09:46:17 +0000
commitaf24274436293bc25b401182a6805de754e8365b (patch)
treeb7e41596c3b2af2016c0069d8008327a5814b501 /sys/modules/lua/lua.c
parentdd2fb1104b12c6fb46fbcb4f0a2c5478653c9a82 (diff)
always put the module on the stack
Diffstat (limited to 'sys/modules/lua/lua.c')
-rw-r--r--sys/modules/lua/lua.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/modules/lua/lua.c b/sys/modules/lua/lua.c
index 9ed427ccbd9..aa7dac662ef 100644
--- a/sys/modules/lua/lua.c
+++ b/sys/modules/lua/lua.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lua.c,v 1.22 2017/05/20 08:31:13 mbalmer Exp $ */
+/* $NetBSD: lua.c,v 1.23 2017/05/20 09:46:17 mbalmer Exp $ */
/*
* Copyright (c) 2011 - 2017 by Marc Balmer <mbalmer@NetBSD.org>.
@@ -514,16 +514,16 @@ lua_require(lua_State *L)
if (md != NULL)
LIST_FOREACH(s, &lua_states, lua_next)
if (s->K->L == L) {
- LIST_FOREACH(m, &s->lua_modules, mod_next)
- if (m == md)
- return 1;
-
if (lua_verbose)
device_printf(sc_self,
"require module %s\n",
md->mod_name);
luaL_requiref(L, md->mod_name, md->open, 0);
+ LIST_FOREACH(m, &s->lua_modules, mod_next)
+ if (m == md)
+ return 1;
+
md->refcount++;
LIST_INSERT_HEAD(&s->lua_modules, md, mod_next);
return 1;