]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Added .listwarps
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 15 Aug 2020 14:00:26 +0000 (16:00 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 15 Aug 2020 14:00:26 +0000 (16:00 +0200)
clientmods/warp/init.lua

index 67f22a90123fb81727e45eece9ff6a58eb0c75e9..9eca73482960be408c65fd1e3a04cb6c36d20d59 100644 (file)
@@ -45,6 +45,22 @@ minetest.register_chatcommand("deletewarp", {
        func = warp.delete,
 })
 
+minetest.register_chatcommand("listwarps", {
+       description = "List all warps.",
+       func = function()
+               local warps = storage:to_table().fields
+               local warplist = {}
+               for warp in pairs(warps) do
+                       table.insert(warplist, warp)
+               end
+               if #warplist > 0 then
+                       return true, table.concat(warplist, ", ")
+               else
+                       return false, "No warps set."
+               end
+       end,
+})
+
 local function do_warp(param)
        if param == "" then return false, "Missing parameter." end
        local success, pos = minetest.parse_pos(param)