I'm creating a plugin that edits scripts for me, and I was wondering how to find out if a number is a string or an actual number? (e.g "2" or 2) Whenever I use typeof() it returns string only for the source, how do I check if the number is part of a string or not?
COMMUNITY QUESTION
How to find numbers through a script's source (using plugins)?
1 answer
Given a string you must find numbers in, you can use string patterns. Specifically, you can use the %d+ pattern, which matches digits with the %d character class, and one or more of them with the + quantifier.
To check if there is a string, we can use string.find(string, "%d+").
Helpful resources:
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
hmm, maybe use tonumber()