Code: Select all
print(bit.bor(1,2))
Code: Select all
require
this is some dumb experience. you may exit now if you don't want to see dumb guy complaining about himself being dumb.
problem is here.
it's known that Lua 5.1 doesn't have bitwise operators.
it's known that LuaJIT is something which rocks.
it's known that BitOp is "a Lua extension for bitwise operations on numbers." from the same author of LuaJIT.
*searches for "bit" on love2d wiki*
the page doesn't exist.
lots of data types, 32bit/64bit things, 8-bit gaming, 16-bit what what buffer....
*searches for "bitop" on love2d wiki*
nothing.
*searches for "bitwise" on love2d wiki*
two pages introducing advanced technologies.
*searches for "bitwise operation" on love2d wiki*
nothing.
*searches for "bitwise operation love2d" on google*
"simulate bit shift in love2d" yes i knoooooow that works but just shit sloooooow!!!!
"I demand that LÖVE add support of lua 5.3" i know that 5.3 has them but i don't think love2d's going to switch to 5.3 any time soon!!
(well though now i found someone very indirecly stating "Additionally, many useful features from Lua 5.2 and 5.3 (e.g. bitwise operations) are covered either by LuaJIT's FFI or (in the case of bitwise ops) by a module included with LuaJIT: http://luajit.org/extensions.html#bit)"..... others also mentioned somehow but mostly saying "that comes with luajit, if luajit is enabled blabla" maybe i missed them a bit.... all refers me to luajit.org and i'm wondering will i need to somehow install it?
that's about the second question: does love2d some with luaJIT? (since the file names doesn't indicate that)
i even saw one saying on stackoverflow: "i'm 90% sure that love2d comes with luajit".....
*searches for "LuaJIT" on love2d wiki*
looooots of "if you're using luajit", "when luajit's jit compiler is enabled", "... js a library for LuaJIT", "love uses luajit by default" (actually the last one is somehow better news)
only one that makes me really confident is in "DistanceBasedCollision"
LOVE USES LUAJIT!!!1!11!!11!!11...on, instead of the second version's three squarings. That said, Löve uses LuaJIT, so if one really needs to optimize, check which is faster.
however, i'm still not sure if that's a separate library for luajit or built-in....
*searching "bitop" on wiki.luajit.org*
only one page with 2 matches redirecting to bitop.
*reads bitop.luajit.org*
looks very like it's a SEEEPAAAARAAATE library i need to somehow install them...
it even says "Compatible with the built-in bitwise operations in LuaJIT 2.0." whaaaat? they are TWO DIFFERENT THIINGS?????? (how can the same thing be "compatible"???) so how can i find the built-in bitwise operations?????
......
much thinking before i finally tried to directly write the code to test and realizing how dumb i was.
though i'm still confused now.
"when do love not come with luajit?"
"how can i enable/disable the jit compiler?"
"if so, i can't use bit.xxx?"
"if so, i can only play with floating point division and modulo, if not manually building love2d to add c extensions?"
at least know for now, on the latest release version of windows, i can use it directly......
my suggestion is......
create pages named "bit", "LuaJIT" on love2d wiki.... say something....
better another "bitwise operator" page, state that "YOU CAN USE IT (THE BITOP LIBRARY WHICH IS UNDER THE NAME bit WHICH COMES WITH LUAJIT2.0 WHICH COMES WITH LOVE)!!!! BY TYPING SOMETHING LIKE bit.bor(a,b)!!!!!! see http://bitop.luajit.org for more"
have a nice day.