lua-users home
lua-l archive

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


As of Lua 5.4, there are no two keywords that share the same first and last letter. There are some that start with the same two letters, (else/elseif, repeat/return) but if we look at the first and last letter they are unique. For example, the only keyword that starts with "e" and ends with "f" is "elseif".

One application of this useless fact would be if one wants to build a perfect hashing function for just Lua keywords. The hash function wouldn't have to look at all the characters of the word; just the first and last one should be enough.

-- Hugo

and break do else elseif end
false for function goto if in
local nil not or repeat return
then true until while