2

So for I game I want the user to be able to do commands. For simplicity all parameters are put into a table.

Example: "message all Hello" -> {"message","all","Hello"}

For that I've used the alphanumeric pattern (%w). Problem is that characters like: _ ; : . Simply can not be used, since they're not alphanumeric. Is there anyway to use the all characters pattern(.), but ignore spaces. Or is there any better way to do it? Thank you for your help

2
  • 1
    How about the "everything but spaces pattern" [^ ]? Commented Jul 16, 2018 at 13:28
  • This has been the pattern i've been looking for! thanks Commented Jul 16, 2018 at 13:37

1 Answer 1

2

According to Lua docs:

Making the letter after the % uppercase inverts the class, so %D will match all non-digit characters.

So the pattern you're looking for is %S+.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah i missed that. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.