Support for bit operations

Roblox games are getting more professional so binary operations would be nice to have, since many algorithms use them, and they would allow efficient serialization of game specific data for storage purposes (roblox cannot implement it efficiently on their side, the creator has much more information about the game because they made it)

  1. Bitwise ops for Lua
  2. A Byte/bit buffer object that can be used kind of like strings (saved to data stores, ByteBufferValue objects…)

2 Can always be scripted into strings, but 1 is inefficient if implemented in Lua so it would be nice to have the built in functionality for that.

It would also be nice to have data structures that are done C side for large data volumes:
-Grid.new(dimensions, size of single cell in bits/bytes/as template lua table)
*To allow anyone to store voxel data compactly for realistic simulation of lets say temperature, wind, pressure, fire, or for making grid based 2D or 3D games.
*Random access, perhaps a optimized call-this-callback-on-this-region-of-cells
-SparseGrid.new(size of single cell)
*Same as above except implemented as quad/octree or whatever to optimize away empty cells and to allow infinite size

Yesssss. I’ve been looking for this for YEARS.

Mainly for an easy way to simulate basic AI behavior. (not even rendering them, just “the masses”)
Although I dont see us getting this :frowning:

You CAN make bit operations in Lua 5.1, but it won’t be as fast as if it were written on the C side.

Made this a few months back:

But yes, I do support your proposal.

[quote] You CAN make bit operations in Lua 5.1, but it won’t be as fast as if it were written on the C side.

Made this a few months back:

But yes, I do support your proposal. [/quote]

Yeah, the point is that the operations would probably be 100 times faster if the built in functionality was available.
I dont need them personally but they are an important part of programming and I dont see any reason for not including them, unless roblox wants to prevent people from making really inefficient bitcoin miners or hash breakers using their servers.

If they were implemented, I would love it if they followed the LuaBitOps style of operations.

Did you guys know that Lua 5.3 will get an “official” bit op library? Lua 5.3 changelog (scroll down). Moreover, a lot of users have already made a bit op library, some in pure Lua, some on the C-side. Take a look here!

I guess that it would be a nice idea to add a bit library.

[quote] Did you guys know that Lua 5.3 will get an “official” bit op library? Lua 5.3 changelog (scroll down). Moreover, a lot of users have already made a bit op library, some in pure Lua, some on the C-side. Take a look here!

I guess that it would be a nice idea to add a bit library. [/quote]

It would be nearly impossible to migrate to Lua 5.1+ because of all the environmental changes.

Also, don’t forget about the dreaded goto.

[quote] Did you guys know that Lua 5.3 will get an “official” bit op library? Lua 5.3 changelog (scroll down). Moreover, a lot of users have already made a bit op library, some in pure Lua, some on the C-side. Take a look here!

I guess that it would be a nice idea to add a bit library. [/quote]

5.2 already had a bit op library. 5.3 just has operators for them instead of you requiring to use a function.

I’m bumping this because it is still relevant and we do really need native Bit operations. Third-party Lua methods are slow.