diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-03-29 20:24:27 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-03-29 20:24:27 +0200 |
commit | a900fd834c1fde07726d0bb18aa982587a35c827 (patch) | |
tree | 6cfb60dc31958eed594687bc6b703eed5419a6cf | |
parent | 9d068d383713406ee078e746b4e4a0149e18ebf2 (diff) | |
download | beerchat-a900fd834c1fde07726d0bb18aa982587a35c827.tar.gz beerchat-a900fd834c1fde07726d0bb18aa982587a35c827.tar.bz2 beerchat-a900fd834c1fde07726d0bb18aa982587a35c827.zip |
Use space instead of comma as an argument separator
-rw-r--r-- | init.lua | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -38,7 +38,7 @@ local whisper_color = "#aaaaaa" -- Whisper color override -- ${message} the actual message that is to be sent -- ${time} the current time in 24 hour format, as returned from os.date("%X") -- -local channel_invitation_string = "|#${channel_name}| Channel invite from (${from_player}), to join the channel, do /jc ${channel_name},${channel_password} after which you can send messages to the channel via #${channel_name}: message" +local channel_invitation_string = "|#${channel_name}| Channel invite from (${from_player}), to join the channel, do /jc ${channel_name} ${channel_password} after which you can send messages to the channel via #${channel_name}: message" local channel_invited_string = "|#${channel_name}| Invite sent to ${to_player}" local channel_created_string = "|#${channel_name}| Channel created" local channel_deleted_string = "|#${channel_name}| Channel deleted" @@ -123,10 +123,9 @@ minetest.register_on_leaveplayer(function(player) end) local create_channel = { - params = "<Channel Name>,<Password (optional)>,<Color (optional, default is #ffffff)>", + params = "<Channel Name> <Password (optional)> <Color (optional, default is #ffffff)>", description = "Create a channel named <Channel Name> with optional <Password> and hexadecimal <Color> ".. - "starting with # (e.g. #00ff00 for green). Use comma's to separate the arguments, e.g. ".. - "/cc my secret channel,#0000ff for a blue colored my secret channel without password", + "starting with # (e.g. #00ff00 for green). Use spaces to separate the arguments." func = function(lname, param) local lowner = lname @@ -134,9 +133,9 @@ local create_channel = { return false, "ERROR: Invalid number of arguments. Please supply the channel name as a minimum" end - local str = string.split(param, ",") + local str = string.split(param, " ") if #str > 3 then - return false, "ERROR: Invalid number of arguments. 4 parameters passed, maximum of 3 allowed: <Channel Name>,<Password>,<Color>" + return false, "ERROR: Invalid number of arguments. 4 parameters passed, maximum of 3 allowed: <Channel Name> <Password> <Color>" end local lchannel_name = string.trim(str[1]) @@ -247,14 +246,14 @@ local my_channels = { } local join_channel = { - params = "<Channel Name>,<Password (only mandatory if channel was created using a password)>", + params = "<Channel Name> <Password (only mandatory if channel was created using a password)>", description = "Join channel named <Channel Name>. After joining you will see messages sent to that channel (in addition to the other channels you have joined)", func = function(name, param) if not param or param == "" then return false, "ERROR: Invalid number of arguments. Please supply the channel name as a minimum" end - local str = string.split(param, ",") + local str = string.split(param, " ") local channel_name = str[1] if not channels[channel_name] then @@ -267,7 +266,7 @@ local join_channel = { if channels[channel_name].password and channels[channel_name].password ~= "" then if #str == 1 then - return false, "ERROR: This channel requires that you supply a password. Supply it in the following format: /jc my channel,password01" + return false, "ERROR: This channel requires that you supply a password. Supply it in the following format: /jc my channel password01" end if str[2] ~= channels[channel_name].password then return false, "ERROR: Invalid password" @@ -318,7 +317,7 @@ local leave_channel = { } local invite_channel = { - params = "<Channel Name>,<Player Name>", + params = "<Channel Name> <Player Name>", description = "Invite player named <Player Name> to channel named <Channel Name>. You must be the owner of the channel in order to do invites", func = function(name, param) local owner = name @@ -327,7 +326,7 @@ local invite_channel = { return false, "ERROR: Invalid number of arguments. Please supply the channel name and the player name" end - local channel_name, player_name = string.match(param, "(.*),(.*)") + local channel_name, player_name = string.match(param, "(%S+)%s+(.*)") if not channel_name or channel_name == "" then return false, "ERROR: Channel name is empty" |