Nevermind I found this lua 5.1 library which is the equivalent of bit32 library in lua 5.2.
http://www.snpedia.com/extensions/Scrib ... /bit32.lua
I could have done this with LuaJIT, maybe it would have been faster, but speed isn't key here, and it saves me work.
How can I use Lua 5.2 for LOVE
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How can I use Lua 5.2 for LOVE
Yes.Croutonix wrote:I just need this?
local bit = require("bit")
Also, curious how getting an external lib instead of writing one line saves you work.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: How can I use Lua 5.2 for LOVE
Wow, a pure Lua implementation of bit32... I wouldn't recommend that EVER, just use local bit32 = require("bit"), it's mostly compatible, maybe with a few minor differences but shouldn't matter that much, test it before going with the pure Lua alternative you suggested
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: How can I use Lua 5.2 for LOVE
It saves me work because bit and bit32 aren't the same.
This I don't need to write missing functions. (that I don't even understand)
But why is it so bad?
This I don't need to write missing functions. (that I don't even understand)
But why is it so bad?
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: How can I use Lua 5.2 for LOVE
Bit operations are hard, you need to separate the number into bits (because you can't look at the inner representation) then compare and perform operations on those bits, then combine all those bits again into a number, when you are handling 2 32bits number your are working with around 192 operations, and probably some of them may not be JIT compiled, and you most likely aren't using a single operation, you probably do more than one, and you probably do all this in a loop which adds up.
LuaJIT library does all this in a single operation compiled by the JIT compiler so it is several orders of magnitudes faster. Also the incompatibilities between bit and bit32 libraries is minimal, and if you find problems you should be able to fix them easily.
Have you find any incompatibilities between the two of them? If so what is it? Maybe we can help you fix them
LuaJIT library does all this in a single operation compiled by the JIT compiler so it is several orders of magnitudes faster. Also the incompatibilities between bit and bit32 libraries is minimal, and if you find problems you should be able to fix them easily.
Have you find any incompatibilities between the two of them? If so what is it? Maybe we can help you fix them
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How can I use Lua 5.2 for LOVE
Also, from a cursory glance, the luajit bit lib has all the functions that bit32 lib has, maybe except some checking ones, and some may have slightly different names.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: How can I use Lua 5.2 for LOVE
bit32.extract, bit32.btest and bit32.replace
I replaced the other functions with luajit bit
I replaced the other functions with luajit bit
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests