summaryrefslogtreecommitdiff
path: root/chatcommands.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-10-04 15:42:29 -0400
committerShadowNinja <shadowninja@minetest.net>2014-10-04 15:58:50 -0400
commitb3873fcfaf2624f8d017ff7ec6cdde4a8ee19caf (patch)
tree6847e090221f9ed62d9b2fbfc56b19179aa50582 /chatcommands.lua
parent9871caf1e28e3a22bba1323fe6a976a7faedde44 (diff)
Make find_areas an admin-only command
Some regexes can be very slow. This also fixes a bug with single-item result sets.
Diffstat (limited to 'chatcommands.lua')
-rw-r--r--chatcommands.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/chatcommands.lua b/chatcommands.lua
index b467331..9123957 100644
--- a/chatcommands.lua
+++ b/chatcommands.lua
@@ -143,6 +143,7 @@ minetest.register_chatcommand("rename_area", {
minetest.register_chatcommand("find_areas", {
params = "<regexp>",
description = "Find areas using a Lua regular expression",
+ privs = areas.adminPrivs,
func = function(name, param)
if param == "" then
return false, "A regular expression is required."
@@ -158,12 +159,12 @@ minetest.register_chatcommand("find_areas", {
local matches = {}
for id, area in pairs(areas.areas) do
- if areas:isAreaOwner(id, name) and
- areas:toString(id):find(param) then
- table.insert(matches, areas:toString(id))
+ local str = areas:toString(id)
+ if str:find(param) then
+ table.insert(matches, str)
end
end
- if #matches > 1 then
+ if #matches > 0 then
return true, table.concat(matches, "\n")
else
return true, "No matches found."