lua-users home
lua-l archive

Re: What's the best way to determine if a string is a reserved word in a C module?

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


I mean Lua reserved words. In fact, my C module accepts strings from Lua and I need to determine if they are reserved words; they are essentially TString objects. So if I can get the TString object, I can determine it directly, Instead of comparing them with a reserved words list, which is costly. I think it might be better for Lua to provide a function such as `luaL_isreserved(lua_State *L, int idx)`.
On 3/31/2020 16:00, Sean Conner wrote:
It was thus said that the Great Huang Luyu once stated:
Hi all,
I want to write a C module for Lua, which needs determine if a string is a
reserved word.
 What do you mean be a "reserved word"? For Lua? For C? The best bet is
to just check a list of words since there aren't that many reserved words in
either language. Lua has around 20+ words (depends upon version) and C has
around 30+ words (again, depends upon version).
 -spc

AltStyle によって変換されたページ (->オリジナル) /