Jump to content

Module:Keybinding

From shapez Wiki
Revision as of 19:27, 29 January 2026 by Dengr1065 (talk | contribs) (Create basic inline keybinding display module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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