[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Next Version of Lua? - Bitwise Ops & Enum/Flags
- From: Henk Boom <henk@...>
- Date: Thu, 11 Jun 2009 15:28:12 -0400
2009/6/11 Olivier Hamel <evilpineapple@cox.net>:
> Olivier Hamel wrote:
>>
>> Note that it's not permitted to do:
>>
>> enum "Test"
>> {
>> "Div",
>> "Multi",
>> "Add",
>> "Sub",
>> "Assign",
>> "Call"
>> }
>
> Gah! I'm an idiot, Sorry! Here:
>
> function enum(strEnumSetName, tblEnumList)
> typecheck(strEnumSetName, "string")
> typecheck(tblEnumList, "table")
> return function()
> for k, v in ipairs(tblEnumList) do
> HackEnumCntr = HackEnumCntr + 1
> _G[k] = 2^HackEnumCntr -- Figure something for handling over
> overflows?
> -- Is it even a possible concern? Never was in my experience...
> end
> end
> end
I'm guessing you meant to move "tblEnumList" into the internal
function's args, right?
function enum(strEnumSetName)
typecheck(strEnumSetName, "string")
typecheck(tblEnumList, "table")
return function(tblEnumList)
for k, v in ipairs(tblEnumList) do
HackEnumCntr = HackEnumCntr + 1
_G[k] = 2^HackEnumCntr -- Figure something for handling over
overflows?
-- Is it even a possible concern? Never was in my experience...
end
end
end