[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C API to check if string is valid varible name
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 24 Mar 2023 10:29:49 -0300
> > For instance?
> I have lua embedded in system where users can define table of variables and
> then write expressions to process them. However i think it would be
> reasonable to have some sanity checks in place, so i don't have to explain
> why formulas using variable called "TIME-MAX" are not working :-) and stuff
> like that...
Up to reserved words, the Lua pattern "^[%a_][%w_]*$" should do the job.