Changeset

11283:f415176281fa

mod_storage_sql: Fix compatibilty with Lua 5.1 string.rep() doesn't have the 3rd argument before Lua 5.2 Revert once we drop support for Lua 5.1
author Kim Alvefur <zash@zash.se>
date Wed, 13 Jan 2021 15:33:44 +0100
parents 11282:cabb022f31c0
children 11284:56ceb6c1bc50
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Tue Jan 12 19:32:10 2021 +0100
+++ b/plugins/mod_storage_sql.lua	Wed Jan 13 15:33:44 2021 +0100
@@ -381,7 +381,8 @@
 	-- Set of ids
 	if query.ids then
 		local nids, nargs = #query.ids, #args;
-		where[#where + 1] = "\"key\" IN (" .. string.rep("?", nids, ",") .. ")";
+		-- COMPAT Lua 5.1: No separator argument to string.rep
+		where[#where + 1] = "\"key\" IN (" .. string.rep("?,", nids):sub(1,-2) .. ")";
 		for i, id in ipairs(query.ids) do
 			args[nargs+i] = id;
 		end