From c017e14084b2ab77013569693de94eb79933020a Mon Sep 17 00:00:00 2001 From: Connor O'Connor Date: Fri, 3 Oct 2025 14:58:28 -0400 Subject: [PATCH] fix deprecated use of getn --- lualib/ltn12.lua | 2 +- lualib/socket/url.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lualib/ltn12.lua b/lualib/ltn12.lua index b42689a..7822e53 100644 --- a/lualib/ltn12.lua +++ b/lualib/ltn12.lua @@ -38,7 +38,7 @@ end -- chains a bunch of filters together -- (thanks to Wim Couwenberg) function filter.chain(...) - local n = table.getn(arg) + local n = #arg local top, index = 1, 1 local retry = "" return function(chunk) diff --git a/lualib/socket/url.lua b/lualib/socket/url.lua index 0e31d8a..f05d91c 100644 --- a/lualib/socket/url.lua +++ b/lualib/socket/url.lua @@ -254,7 +254,7 @@ function parse_path(path) path = path or "" --path = string.gsub(path, "%s", "") string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end) - for i = 1, table.getn(parsed) do + for i = 1, #parsed do parsed[i] = unescape(parsed[i]) end if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end @@ -272,7 +272,7 @@ end ----------------------------------------------------------------------------- function build_path(parsed, unsafe) local path = "" - local n = table.getn(parsed) + local n = #parsed if unsafe then for i = 1, n-1 do path = path .. parsed[i]