From 955ca53ef9a72be7e7f11df3c61a82339864fc4e Mon Sep 17 00:00:00 2001 From: Och Noe Date: Fri, 19 Jun 2020 19:18:27 +0200 Subject: new command: .wp_grep (written by erstazi, THANKS) --- init.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 436b210..c400bf8 100644 --- a/init.lua +++ b/init.lua @@ -324,3 +324,26 @@ minetest.register_chatcommand('wp_shift', { ) + +-- wp_grep written by erstazi (player at Linux-Forks.de ) +minetest.register_chatcommand('wp_grep', { + params = '', + description = 'lists waypoints', + func = safe(function(param) + local wpname = param + local count = 0 + for name, point in pairsByKeys(waypoints, lc_cmp) do + if string.find(name, wpname) then + count = count + 1 + minetest.display_chat_message( + ('%s -> %s'):format(name, tostring_point(point)) + ) + end + end + + if count == 0 then + minetest.display_chat_message(('waypoint "%s" not found.'):format(wpname)) + end + end), +}) + -- cgit v1.2.3