Chat command regex tweaks
This commit is contained in:
parent
db664d68f8
commit
790ed15594
@ -44,7 +44,7 @@ minetest.register_chatcommand("set_owner", {
|
|||||||
.." area to any existing area",
|
.." area to any existing area",
|
||||||
privs = {areas=true},
|
privs = {areas=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local found, _, ownername, areaname = param:find('^([^%s]+)%s(.+)$')
|
local found, _, ownername, areaname = param:find('^([^ ]+) (.+)$')
|
||||||
|
|
||||||
if not found then
|
if not found then
|
||||||
minetest.chat_send_player(name, "Incorrect usage, see /help set_owner")
|
minetest.chat_send_player(name, "Incorrect usage, see /help set_owner")
|
||||||
@ -90,7 +90,7 @@ minetest.register_chatcommand("add_owner", {
|
|||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local found, _, pid, ownername, areaname
|
local found, _, pid, ownername, areaname
|
||||||
= param:find('^(%d+)%s([^%s]+)%s(.+)$')
|
= param:find('^(%d+) ([^ ]+) (.+)$')
|
||||||
|
|
||||||
if not found then
|
if not found then
|
||||||
minetest.chat_send_player(name, "Incorrect usage, see /help set_owner")
|
minetest.chat_send_player(name, "Incorrect usage, see /help set_owner")
|
||||||
@ -142,7 +142,7 @@ minetest.register_chatcommand("rename_area", {
|
|||||||
description = "Rename a area that you own",
|
description = "Rename a area that you own",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local found, _, id, newName = param:find("^(%d+)%s(.+)$")
|
local found, _, id, newName = param:find("^(%d+) (.+)$")
|
||||||
if not found then
|
if not found then
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
"Invalid usage, see /help rename_area")
|
"Invalid usage, see /help rename_area")
|
||||||
@ -274,7 +274,7 @@ minetest.register_chatcommand("change_owner", {
|
|||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local found, _, id, new_owner =
|
local found, _, id, new_owner =
|
||||||
param:find('^(%d+)%s+([^%s]+)$')
|
param:find('^(%d+) ([^ ]+)$')
|
||||||
|
|
||||||
if not found then
|
if not found then
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
|
4
pos.lua
4
pos.lua
@ -44,7 +44,7 @@ minetest.register_chatcommand("area_pos1", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = nil
|
local pos = nil
|
||||||
local found, _, x, y, z = param:find(
|
local found, _, x, y, z = param:find(
|
||||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
|
||||||
if found then
|
if found then
|
||||||
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||||
elseif param == "" then
|
elseif param == "" then
|
||||||
@ -77,7 +77,7 @@ minetest.register_chatcommand("area_pos2", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = nil
|
local pos = nil
|
||||||
local found, _, x, y, z = param:find(
|
local found, _, x, y, z = param:find(
|
||||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
|
||||||
if found then
|
if found then
|
||||||
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||||
elseif param == "" then
|
elseif param == "" then
|
||||||
|
Loading…
Reference in New Issue
Block a user