From 4ecdd3c18ccc5d3bcaa82ed720bf28443aa0ca9d Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 12 Jun 2026 00:56:21 -0500 Subject: http body parsing rewrite --- src/lua.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/lua.c') diff --git a/src/lua.c b/src/lua.c index 2c9692f..212f7c4 100644 --- a/src/lua.c +++ b/src/lua.c @@ -14,6 +14,16 @@ int luaI_nothing(lua_State* L){ return 0; } +void luaI_fromparray(lua_State* L, int table_idx, parray_t* table, int strval){ + for(int i = 0; i != table->len; i++){ + if(table->P[i].value == NULL) lua_pushboolean(L, 1); + else if(strval) lua_pushlstring(L, ((str*)table->P[i].value)->c, ((str*)table->P[i].value)->len); + else lua_pushstring(L, (char*)table->P[i].value); + + lua_setfield(L, table_idx, table->P[i].key->c); + } +} + int luaI_lowercase_index(lua_State* L){ if(lua_type(L, 2) == LUA_TSTRING){ str* s = str_init(lua_tostring(L, 2)); -- cgit v1.2.3