module refactoring

This commit is contained in:
Simon Hirsig
2017-11-01 15:01:41 +01:00
parent 9989ceb42f
commit 8823b34904
36 changed files with 669 additions and 646 deletions
+4 -2
View File
@@ -1,7 +1,9 @@
module 'aux'
local T = require 'T'
function C(r, g, b, a)
local mt = O('__metatable', false, '__newindex', nop, 'color', A(r, g, b, a))
local mt = T.map('__metatable', false, '__newindex', nop, 'color', T.list(r, g, b, a))
function mt:__call(text)
local r, g, b, a = unpack(mt.color)
if text then
@@ -14,7 +16,7 @@ function C(r, g, b, a)
local r, g, b, a = unpack(mt.color)
return format('|c%02X%02X%02X%02X', a, r, g, b) .. text
end
return setmetatable(T, mt)
return setmetatable(T.acquire(), mt)
end
M.color = immutable-{