[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fast Lua code checking, whether user entered a valid variable name?
- From: Rolf Kalbermatter <rolf.kalbermatter@...>
- Date: Mon, 10 Jul 2023 09:56:36 +0300
I think Robert has posted a string matching pattern in the not so far past here on this list, which he said was taken verbatim from the Lua sources.
Sent from my iPhone
> On 10 Jul 2023, at 09:31, bil til <biltil52@gmail.com> wrote:
>
> Sorry, for this quite basic question, but I do not find nice answers
> for this in Internet - although I think this is quite a common problem
> for a Lua user program:
>
> I would like the user to enter some variable name, or just some name
> which then I also want to use as name for a Lua global object.
>
> Is there any fast / standard method in my Lua user program to check,
> whether the user entered a string which is allowed as a "standard
> name" for a variable naming? (start by ascii char, containing only
> chars and numbers and '_')? (As I see, there are not such "C style
> character checking" functions in basic Lua, like "ischar / islower /
> isupper / isdigit...").
>
> Or is it wise / without problems, to allow the user also to use "more
> bizarre names" for naming variables dynamically in his Lua code, e. g.
> variable names containing spaces, or UTF characters or further things?