Sha256: 4ea1c459825d1db6a3594203e2631790f7380aaa29918cb1876240ef89cd1002
Contents?: true
Size: 606 Bytes
Versions: 396
Compression:
Stored size: 606 Bytes
Contents
local function offset(letter) return letter:byte() - ('A'):byte() end local function row(which, current) local outer_padding = (' '):rep(offset(which) - offset(current)) local row = (' '):rep(offset(which) * 2 + 1) row = row:gsub('^' .. outer_padding .. '.', outer_padding .. current) row = row:gsub('.' .. outer_padding .. '$', current .. outer_padding) return row .. '\n' end return function(which) local diamond = row(which, which) for i = which:byte() - 1, ('A'):byte(), -1 do local row = row(which, string.char(i)) diamond = row .. diamond .. row end return diamond end
Version data entries
396 entries across 396 versions & 1 rubygems