[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua binding: How to implement C enum
- From: Petite Abeille <petite.abeille@...>
- Date: Thu, 15 Dec 2011 22:10:47 +0100
On Dec 15, 2011, at 9:53 PM, Patrick Rapin wrote:
Various way to store flags and various way to check them
> - single concatenated string: "frontonly, backvideo"
if singleConcatenatedString:find( 'frontonly', 1, true ) then
end
> - a list of strings: { "frontonly","backvideo" }
for anIndex, aValue in ipairs( aListOfStrings ) do
if aValue == 'frontonly' then
end
end
> - a table with string keys: { frontonly=true, backvideo=true }
if aTableWithStringKeys[ 'backvideo' ] then
end
> - variable number of parameters: "frontonly", "backvideo"
for anIndex = 1, select( '#', ... ) do
if select( anIndex, ... ) == 'frontonly' do
end
end
The third option, aTableWithStringKeys, looks the most convenient :)