Use cleaner gsub instead of if-sub

This commit is contained in:
1F616EMO 2024-06-18 06:38:33 +08:00
parent 570c0f299a
commit 23104f298f
No known key found for this signature in database
GPG key ID: EF52EFA8E05859B2

View file

@ -364,9 +364,7 @@ function default.register_fence(name, def)
-- Register crafting recipe, trim away starting colon if any
if not material then return end
if string.sub(name, 1,1) == ":" then
name = string.sub(name, 2)
end
name = string.gsub(name, "^:", "")
minetest.register_craft({
output = name .. " 4",
recipe = {
@ -438,9 +436,7 @@ function default.register_fence_rail(name, def)
-- Register crafting recipe, trim away starting colon if any
if not material then return end
if string.sub(name, 1,1) == ":" then
name = string.sub(name, 2)
end
name = string.gsub(name, "^:", "")
minetest.register_craft({
output = name .. " 16",
recipe = {
@ -491,9 +487,7 @@ function default.register_mesepost(name, def)
-- Register crafting recipe, trim away starting colon if any
if not material then return end
if string.sub(name, 1,1) == ":" then
name = string.sub(name, 2)
end
name = string.gsub(name, "^:", "")
minetest.register_craft({
output = name .. " 4",
recipe = {