aliases = {} function alias(short, orig, param) aliases[short] = { orig = orig, param = param or "" } end alias("gim", "giveme") alias("grm", "grantme") -- needs to be in minetest game? -- alias("h", "home") alias("sd", "shutdown") alias("t", "teleport") alias("t0", "teleport", "0 0 0") minetest.register_on_sending_chat_message(function(message) if message:sub(1,1) ~= "/" then return end local cmd, param = string.match(message, "^/([^ ]+) *(.*)") if not cmd then minetest.display_chat_message("-!- Empty command") return true end param = param or "" if (not minetest.registered_chatcommands[cmd]) and (aliases[cmd]) then if aliases[cmd].param ~= "" then param = aliases[cmd].param end -- minetest.display_chat_message("Param = " .. param) minetest.display_chat_message("alias for: /" .. aliases[cmd].orig .. " " .. param) minetest.run_server_chatcommand(aliases[cmd].orig, param) return true end end)