Bitwise operations for cross Lua compatibility.

This commit is contained in:
jussi
2024-05-01 15:21:28 +03:00
parent bdd660be01
commit 4452bccfa6
14 changed files with 261 additions and 112 deletions

View File

@@ -7,11 +7,6 @@ end
local utillib = {}
-- Does not work with dictionaries.
function utillib.arrayClone( org )
return { table.unpack( org ) }
end
function utillib.deepCopy( orig )
local copy
@@ -156,7 +151,8 @@ function utillib.colorLerp( a, b, f )
return {
utillib.round( utillib.lerp( a[1], b[1], f ) ),
utillib.round( utillib.lerp( a[2], b[2], f ) ),
utillib.round( utillib.lerp( a[3], b[3], f ) ) }
utillib.round( utillib.lerp( a[3], b[3], f ) )
}
end
-- Move secuence of elements inside table.
@@ -176,4 +172,15 @@ function utillib.randomFloat( min, max )
return min + math.random() * ( max - min );
end
function utillib.printBin( v )
for i = 31, 0, -1 do
if RL.BitGet( v, i ) then
io.write( "1" )
else
io.write( "0" )
end
end
print()
end
return utillib