Content deleted Content added
Remove print() call (I ran this at home first) |
Revert: Looks like align and header already work (???) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 133:
-- Loop over rows, which are delimited by /
for srow in string.gmatch("/" .. fen, "/%w+") do
srow = srow:gsub("/","") -- clean up row
-- Loop over all letters and numbers in the row
-- Since Lua regexes do not have the | operator, we have
Line 144 ⟶ 143:
local pend = 0
local length = srow:len()
while index <= length do
-- Look for a number. Can have multiple digits
pstart, pend = srow:find("%d+", index)
Line 158 ⟶ 157:
if pstart == index then
piece = srow:sub(pstart, pstart)
-- l: White (light); d: Black (dark)▼
index = pstart + 1
▲ -- l: White (light); d: Black (dark)
local color = piece:match( '%u' ) and 'l' or 'd'
piece = piece:lower()
|