It makes sense to first verify the hlua context is valid. It is probably
better than doing it after updated the appctx.
struct stconn *sc;
struct stream *s;
+ /* Get hlua struct, or NULL if we execute from main lua state */
+ hlua = hlua_gethlua(L);
+ if (!hlua)
+ return 0;
+
if (lua_gettop(L) < 2)
WILL_LJMP(luaL_error(L, "connect: need at least 2 arguments"));
WILL_LJMP(luaL_error(L, "connect: internal error"));
}
- /* Get hlua struct, or NULL if we execute from main lua state */
- hlua = hlua_gethlua(L);
- if (!hlua)
- return 0;
-
/* inform the stream that we want to be notified whenever the
* connection completes.
*/