Input v is a table containing the inputs of the logic gate.
Input m is just the toggle of the certain object, only needed for the SWITCH gate.
The player will be able to pack many of the basic gates listed in the dictionary above, but as well as other packed gates.
But with the speed I’m simulating the gates on (in the client) being like 8 gates per frame, I need to simulate packed gates at the same speed as basic gates.
Any ideas on how to make a method to run loads of Boolean operations ( AND, NOT, OR ) in a single line, like how the basic gates are run, instead of keeping to run functions?
have you taken a look at the built in bit32 library? bit32 | Documentation - Roblox Creator Hub This library includes all the primitive logic functions needed for your logic gates
edit: all these logic functions take in tuple arguments as well
Check my profile, I’ve made a tutorial on Bit32 aswell as a module for the library, In my case instead of needing 32 bits for logic operations, I just need 1 bit.
To adapt my method to bit32, I’d need to use 1’s and 0’s instead of booleans which I use currently, and for my case c = a and b is far better than c = bit32.extract(bit32.band(a,c), 0)
So to clarify what you want. For example, if you wanted to make a half adder, you want to make a function for it similar to the ones in your baseFunctions table by only using the ternary operators?
To me, it seems like you’re going to have to hard code each packed gate if you want it to run all the turnery operators on one line. Or you’re going to need to create your own compiler so that it sets it up that way during runtime.