Re: Next Version of Lua? - Bitwise Ops & Enum/Flags
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Next Version of Lua? - Bitwise Ops & Enum/Flags
- From: Olivier Hamel <evilpineapple@...>
- Date: 2009年6月11日 14:05:25 -0400
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
Olivier