diff options
| author | jussi | 2024-05-01 15:21:28 +0300 |
|---|---|---|
| committer | jussi | 2024-05-01 15:21:28 +0300 |
| commit | 4452bccfa63cf86c134aa616ee0bebcc66beca03 (patch) | |
| tree | a40befeb0393fd5599240ccb85a4500781d78c17 /examples/resources/lib/utillib.lua | |
| parent | bdd660be01f3742befe15dff26929a77eeefe61d (diff) | |
| download | reilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.tar.gz reilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.tar.bz2 reilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.zip | |
Bitwise operations for cross Lua compatibility.
Diffstat (limited to 'examples/resources/lib/utillib.lua')
| -rw-r--r-- | examples/resources/lib/utillib.lua | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/examples/resources/lib/utillib.lua b/examples/resources/lib/utillib.lua index a661f60..4054006 100644 --- a/examples/resources/lib/utillib.lua +++ b/examples/resources/lib/utillib.lua @@ -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 |
