-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or request
Description
There's a need for two command interfaces, one from the client, and one from stdin. A command from the server would not have a player_id.
Net:on("command", function(event)
-- { player_id: string?, command: string }
print(event.player_id, event.command)
end)Responding to the client would require a new function or a set of new functions. We have print, warn, and printerr for stdout, it may make sense to have Net equivalents such as Net.print(player_id, ...) with nil player_id resolving to stdout instead of sending a packet.
Net:on("command", function(event)
if not event.command:find("^/echo ") then
return
end
local message = event.command:sub(7)
Net.print(event.player_id, message)
end)The command listener above would respond to /echo hello with hello to the player or cli depending on where the command was entered.
A simple chat could be implemented by running Net.print over every player if the message does not start with a /. The scripter could decide if the chat would be per area or server wide as well.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request