Module:Keyboard vis: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
Tristanbay (talk | contribs) fixed resizing |
||
| (17 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local | local END_L = '[[File:Keyboard_vis_end_left.png|20px]]' | ||
local | local END_R = '[[File:Keyboard_vis_end_right.png|20px]]' | ||
local | local BORDER_BLACK_KEY = '[[File:Keyboard_vis_border_black_key.png|20px]]' | ||
local BORDER_WHITE_KEY = '[[File:Keyboard_vis_border_white_key.png|20px]]' | |||
local | |||
-- Produces a small keyboard visualization | -- Produces a small keyboard visualization | ||
| Line 16: | Line 11: | ||
local step_pattern = step_pattern or "LLLsLLs" | local step_pattern = step_pattern or "LLLsLLs" | ||
local | local result = END_L | ||
for i = 1, #step_pattern do | for i = 1, #step_pattern do | ||
local current_step = step_pattern:sub(i,i) | local current_step = step_pattern:sub(i,i) | ||
if current_step == "L" then | if current_step == "L" then | ||
result = result .. BORDER_BLACK_KEY | |||
elseif current_step == "s" then | elseif current_step == "s" then | ||
result = result .. BORDER_WHITE_KEY | |||
end | end | ||
end | end | ||
result = result .. END_R | |||
return result | |||
return | |||
end | end | ||
return p | return p | ||