File

libs/table.lua @ 501:419c248919e8

util.dataforms: Remove local copy The main difference was the from_stanza() function, which was used in by 'clix adhoc', so moving it there seems sensible. Maybe reconsider upstreaming it to Prosody, but it's not used anywhere there.
author Kim Alvefur <zash@zash.se>
date Fri, 23 Jun 2023 12:38:58 +0200
parent 483:33d566513eb0
line wrap: on
line source

return {
	pack = function(...) return {n = select("#", ...); ...} end;
	create = function() return {} end;
	move = function (a1, f, e, t, a2)
		a2 = a2 or a1;
		if e >= f then
			local n = (e - f) + 1;
			if t > e or t <= f or a1 ~= a2 then
				for i = 0, n-1 do
					a2[t+i] = a1[f+i];
				end
			else
				for i = n-1, 0, -1 do
					a2[t+i] = a1[f+i];
				end
			end
		end
		return a2;
	end;
}