LastMUD/internal/command/parameter.go
Miroslav Vasilev 681f153881 Move Commands
2025-06-27 14:58:52 +03:00

25 lines
431 B
Go

package command
import "strconv"
type Parameter struct {
value string
}
func CreateParameter(value string) Parameter {
return Parameter{
value: value,
}
}
func (p Parameter) AsString() (res string, err error) {
return p.value, nil
}
func (p Parameter) AsInteger() (res int, err error) {
return strconv.Atoi(p.value)
}
func (p Parameter) AsDecimal() (res float64, err error) {
return strconv.ParseFloat(p.value, 32)
}