Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Can we do Bitwise Operations, or do i need a pseudo function to iterate through options?

Asked by 5 years ago

I'd like to do something similar to the following, but with fewer If statements, if you get where I am going with this; through research it appears Roblox Lua doesn't allow for Lua 5.3 bitwise operations?

local N = 1                 -- Bitwise enumerators for wall placement
local S = 2
local E = 4
local W = 8

if bitValue == N or bitValue == N + S .......... then  -- North Wall
    InsertWallPart(parent, x, _posY or defaultFloorY, z, N)
end
if bitValue == W then  -- West Wall
    InsertWallPart(parent, x, _posY or defaultFloorY, z, W)
end
if bitValue == S then 
    InsertWallPart(parent, x, _posY or defaultFloorY, z, S)
end
0
"Roblox Lua" isn't its own language. User#19524 175 — 5y
0
^ he's right in saying roblox lua because it's the way roblox modded lua that doesn't allow him to use them User#22604 1 — 5y
0
Throw that into the answer and I'll credit you, because it definitely worked for my case Karl_Poppa 11 — 5y

1 answer

Log in to vote
0
Answered by 3 years ago

http://wiki.roblox.com/index.php?title=User:Kingkiller1000/Bitwise_Operators this might have some of what you need (from comment by User#22604)

Ad

Answer this question