Jump to content

Module:Keybinding

From shapez Wiki

Documentation for this module may be created at Module:Keybinding/doc

-- This module is used by Template:Kbd to display an in-game keyboard shortcut
-- without hardcoding its name or default setting.

local p = {}
local keys = mw.loadData("Module:Keybinding/KnownKeys")

function p.inline(frame)
	local id = frame.args.id
	local key = id and keys[id] or {
		"Unknown Key ID (" .. tostring(id) .. ")",
		"NONE"
	}

	return mw.html.create("kbd")
		:tag("kbd")
		:wikitext(key[2])
		:done()
		:wikitext(" " .. key[1])
end

return p