Thu, 23 Mar 2023 18:56:32 +0000
component: Avoid adding to the global stream metatable
This allows component and client connections to be made side-by-side.
Previous to this change, loading this connection module would break the
ability to make client connections, due to overriding stream methods such as
:reopen() and :reset().
A next step would be to share the methods that the two connection modules have
in common.
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; }