Software /
code /
prosody-modules
Changeset
6320:ebcf612da2b1
mod_http_oauth2: Use numeric for loop instead of ipairs
Pedantic attempted optimization, reducing function calls.
I didn't even measure, only vaguely recall that this is faster in PUC Lua.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 03 Jul 2025 12:14:53 +0200 |
parents | 6319:63ef69b2f046 |
children | 6321:e174e12549e1 |
files | mod_http_oauth2/mod_http_oauth2.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Wed Jul 02 16:15:32 2025 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Thu Jul 03 12:14:53 2025 +0200 @@ -29,8 +29,8 @@ end local function array_contains(haystack, needle) - for _, item in ipairs(haystack) do - if item == needle then + for i = 1, #haystack do + if haystack[i] == needle then return true end end