mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 09:50:28 +00:00
Update LuaGetParam (via LuaPushUrlParams) to return empty table when no parameters (#97).
This commit is contained in:
parent
c89bc56f6a
commit
3425a8f58f
1 changed files with 1 additions and 3 deletions
|
@ -4043,8 +4043,8 @@ static int LuaGetParam(lua_State *L) {
|
||||||
|
|
||||||
static void LuaPushUrlParams(lua_State *L, struct UrlParams *h) {
|
static void LuaPushUrlParams(lua_State *L, struct UrlParams *h) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
lua_newtable(L);
|
||||||
if (h->p) {
|
if (h->p) {
|
||||||
lua_newtable(L);
|
|
||||||
for (i = 0; i < h->n; ++i) {
|
for (i = 0; i < h->n; ++i) {
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
lua_pushlstring(L, h->p[i].key.p, h->p[i].key.n);
|
lua_pushlstring(L, h->p[i].key.p, h->p[i].key.n);
|
||||||
|
@ -4055,8 +4055,6 @@ static void LuaPushUrlParams(lua_State *L, struct UrlParams *h) {
|
||||||
}
|
}
|
||||||
lua_seti(L, -2, i + 1);
|
lua_seti(L, -2, i + 1);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
lua_pushnil(L);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue