lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Dne 2023-03-24 12:57, Luiz Henrique de Figueiredo napsal:
Is there some C API to check wether given string is a valid identifier?

No. But see the code for "identifier or reserved word" in llex:
https://www.lua.org/source/5.1/llex.c.html#llex

It would be really beneficial in some cases.

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...

--
S pozdravem
Best regards
     Tomáš Mudruňka - SPOJE.NET s.r.o.