From 077f4d1bd23ba38652c16520d60c9ff9ed4b02e3 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Mon, 22 Aug 2022 20:01:08 -0700 Subject: [PATCH] Update to allow using MapContentType from redbean REPL --- tool/net/redbean.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 9851d14d9..d7ad4bec0 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -5171,6 +5171,12 @@ static void LuaInit(void) { #ifndef STATIC lua_State *L = GL; LuaSetArgv(L); + + // create a list of custom content types + lua_pushlightuserdata(L, (void *)&ctIdx); // push address as unique key + lua_newtable(L); + lua_settable(L, LUA_REGISTRYINDEX); // registry[&ctIdx] = {} + if (interpretermode) { int rc = LuaInterpreter(L); LuaDestroy(); @@ -5180,11 +5186,6 @@ static void LuaInit(void) { } exit(rc); } - // create a list of custom content types - lua_pushlightuserdata(L, (void *)&ctIdx); // push address as unique key - lua_newtable(L); - lua_settable(L, LUA_REGISTRYINDEX); // registry[&ctIdx] = {} - if (LuaRunAsset("/.init.lua", true)) { hasonhttprequest = IsHookDefined("OnHttpRequest"); hasonclientconnection = IsHookDefined("OnClientConnection");