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",
|
||||
privs = {areas=true},
|
||||
func = function(name, param)
|
||||
local found, _, ownername, areaname = param:find('^([^%s]+)%s(.+)$')
|
||||
local found, _, ownername, areaname = param:find('^([^ ]+) (.+)$')
|
||||
|
||||
if not found then
|
||||
minetest.chat_send_player(name, "Incorrect usage, see /help set_owner")
|
||||
|
@ -90,7 +90,7 @@ minetest.register_chatcommand("add_owner", {
|
|||
privs = {},
|
||||
func = function(name, param)
|
||||
local found, _, pid, ownername, areaname
|
||||
= param:find('^(%d+)%s([^%s]+)%s(.+)$')
|
||||
= param:find('^(%d+) ([^ ]+) (.+)$')
|
||||
|
||||
if not found then
|
||||
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",
|
||||
privs = {},
|
||||
func = function(name, param)
|
||||
local found, _, id, newName = param:find("^(%d+)%s(.+)$")
|
||||
local found, _, id, newName = param:find("^(%d+) (.+)$")
|
||||
if not found then
|
||||
minetest.chat_send_player(name,
|
||||
"Invalid usage, see /help rename_area")
|
||||
|
@ -274,8 +274,8 @@ minetest.register_chatcommand("change_owner", {
|
|||
privs = {},
|
||||
func = function(name, param)
|
||||
local found, _, id, new_owner =
|
||||
param:find('^(%d+)%s+([^%s]+)$')
|
||||
|
||||
param:find('^(%d+) ([^ ]+)$')
|
||||
|
||||
if not found then
|
||||
minetest.chat_send_player(name,
|
||||
"Invalid usage,"
|
||||
|
|
4
pos.lua
4
pos.lua
|
@ -44,7 +44,7 @@ minetest.register_chatcommand("area_pos1", {
|
|||
func = function(name, param)
|
||||
local pos = nil
|
||||
local found, _, x, y, z = param:find(
|
||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
||||
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
|
||||
if found then
|
||||
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||
elseif param == "" then
|
||||
|
@ -77,7 +77,7 @@ minetest.register_chatcommand("area_pos2", {
|
|||
func = function(name, param)
|
||||
local pos = nil
|
||||
local found, _, x, y, z = param:find(
|
||||
"^(-?%d+)[%s%,]+(-?%d+)[%s%,]+(-?%d+)$")
|
||||
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
|
||||
if found then
|
||||
pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
|
||||
elseif param == "" then
|
||||
|
|
Loading…
Reference in New Issue
Block a user