Minetest-WorldEditAdditions/worldeditadditions_commands/commands/extra/basename.lua

21 lines
1.3 KiB
Lua
Raw Normal View History

-- ██████ █████ ███████ ███████ ███ ██ █████ ███ ███ ███████
-- ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██
-- ██████ ███████ ███████ █████ ██ ██ ██ ███████ ██ ████ ██ █████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██████ ██ ██ ███████ ███████ ██ ████ ██ ██ ██ ██ ███████
worldeditadditions_core.register_command("basename", {
params = "<nodealias>",
description = "Returns the base name of nodes that use a given alias.",
privs = {worldedit = true},
2021-02-25 04:35:20 +01:00
parse = function(params_text)
if params_text == "" or not params_text then
return false, "Node not specified."
end
return true, params_text
end,
func = function(name, params_text)
2021-02-25 04:35:20 +01:00
if name == nil then return end
2022-09-18 17:33:37 +02:00
return true, worldedit.normalize_nodename(params_text) or ('Error 404: "'..params_text..'" not found!')
end
})