Skip to content

Create a command argument parser #117

@NiLSPACE

Description

@NiLSPACE

Currently every command has to be manually parsed to check if all the parameters are correct and the extract the values from them. If we'd create some kind of parser that would allow us to do this automatically creating new commands would get allot easier. I had something like this in mind:

function HandleCommand(a_Split, a_Player)
	-- //command <radius> <block> [hollow]
	local parser, errorMsg = cCommandParser:new("<CommandName> <radius:number> <block:block> [hollow:bool]")
		:Parse(a_Split)
		
	if (not parser) then
		a_Player:SendMessage(cChatColor.Rose .. errorMsg)
		return true
	end
	
	DoSomething(parser.radius, parser.block, parser.hollow)
	return true;
end

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions