[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: predefined constants
- From: "Ashwin Hirschi" <deery@...>
- Date: Fri, 23 Jul 2004 18:07:34 +0200
I am looking at cutting an existing c++ algorithm to lua.
The current c++ version uses a lot (~30) of #defined state flags.
Since it looks like you're about to do a lot of dispatching based on a state variable that can take several dozen forms, you might consider creating a table that maps each state value to a function to handle that state.
To store / define the various state constants I'd go with strings: using them as indexes (or comparing them, for that matter) is very fast, because Lua stores them only once.
Ashwin.
--
no signature is a signature.