lua-users home
lua-l archive

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

> Like I said before, I already have a solution that is computing a hash of
> the string and using it in the switch. What I'm looking for is someway to
> use a hash that's already computed and save some cycles from my binding
> code.

Why not just use enums everywhere.  You can push them into Lua and
pass them as args to your C code instead.  It seems like this would be
much more maintainable and less of a PITA.  The point of strings is
that they can be any sequence of characters, which if you're using in
a switch based on hash values doesn't apply to your case.  Basically
you're treating strings as enums, so why not just use the best tool
for the job?