Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 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 |
| parent | 11279:f225070e2b8a |
| child | 11354:10fba62332c5 |
comparison
equal
deleted
inserted
replaced
| 11282:cabb022f31c0 | 11283:f415176281fa |
|---|---|
| 379 end | 379 end |
| 380 | 380 |
| 381 -- Set of ids | 381 -- Set of ids |
| 382 if query.ids then | 382 if query.ids then |
| 383 local nids, nargs = #query.ids, #args; | 383 local nids, nargs = #query.ids, #args; |
| 384 where[#where + 1] = "\"key\" IN (" .. string.rep("?", nids, ",") .. ")"; | 384 -- COMPAT Lua 5.1: No separator argument to string.rep |
| 385 where[#where + 1] = "\"key\" IN (" .. string.rep("?,", nids):sub(1,-2) .. ")"; | |
| 385 for i, id in ipairs(query.ids) do | 386 for i, id in ipairs(query.ids) do |
| 386 args[nargs+i] = id; | 387 args[nargs+i] = id; |
| 387 end | 388 end |
| 388 end | 389 end |
| 389 end | 390 end |