8,756
edits
(basic implementation of beta shaders) |
(implemented of how i assume alternation works) |
||
Line 116: | Line 116: | ||
strtbl = strtotbl(text) | strtbl = strtotbl(text) | ||
finaltbl = {} | finaltbl = {} | ||
if type == 'sequence' then | interval = 1 | ||
if type == 'alternation' then | |||
interval = math.floor(#strtbl/#colorlist) --sets interval that color code switches. | |||
overflowbehavior = function(f) return colorlist[#colorlist] end | |||
elseif type == 'sequence' then | |||
overflowbehavior = function(f) | overflowbehavior = function(f) | ||
e = f%#colorlist | e = f%#colorlist | ||
Line 125: | Line 129: | ||
overflowbehavior = function(f) return 'y' end | overflowbehavior = function(f) return 'y' end | ||
end | end | ||
ci = 1 | |||
for i=1, #strtbl do | for i=1, #strtbl do | ||
if | if ci > #colorlist then | ||
hexcolor = overflowbehavior( | hexcolor = overflowbehavior(ci) | ||
else | else | ||
hexcolor = colorlist[ | hexcolor = colorlist[ci] | ||
end | end | ||
finaltbl[i] = "<span style=\"color: " .. luatable.parse(hexcolor) .. ";\">" .. strtbl[i].. "</span>" | finaltbl[i] = "<span style=\"color: " .. luatable.parse(hexcolor) .. ";\">" .. strtbl[i].. "</span>" | ||
if i%interval == 0 then | |||
ci = ci + 1 | |||
end | |||
end | end | ||
return table.concat(finaltbl) | return table.concat(finaltbl) | ||
end | end | ||
function p.test() | function p.test() | ||
return p.shader('structural', 'Y-y-K-y-Y', 'alternation') | |||
return p.shader('Stopsvalinn', 'R-r-K-y-Y', 'sequence') | --return p.shader('Stopsvalinn', 'R-r-K-y-Y', 'sequence') | ||
end | end | ||
return p | return p |