Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

4 comments

0

"Roblox Lua" isn't its own language.

0

^ he's right in saying roblox lua because it's the way roblox modded lua that doesn't allow him to use them

0

Throw that into the answer and I'll credit you, because it definitely worked for my case

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.