diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/platformer/main.lua | 6 | ||||
| -rw-r--r-- | examples/resources/lib/utillib.lua | 16 | ||||
| -rw-r--r-- | examples/resources/lib/vector2.lua | 1 | ||||
| -rw-r--r-- | examples/resources/lib/vector3.lua | 1 |
4 files changed, 14 insertions, 10 deletions
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua index d68b3b8..e325fbd 100644 --- a/examples/platformer/main.lua +++ b/examples/platformer/main.lua @@ -80,12 +80,6 @@ local function createMap() tilemap.tiles[1][8] = 6 end -function log( logLevel, message ) - if logLevel == LOG_WARNING then - error( "Terminated because of warning" ) - end -end - function init() local monitorPos = Vec2:new( RL_GetMonitorPosition( monitor ) ) local monitorSize = Vec2:new( RL_GetMonitorSize( monitor ) ) diff --git a/examples/resources/lib/utillib.lua b/examples/resources/lib/utillib.lua index 8d3ce9e..b2b93e0 100644 --- a/examples/resources/lib/utillib.lua +++ b/examples/resources/lib/utillib.lua @@ -1,4 +1,4 @@ --- Define useful global stuff. +-- Define useful global functions. local utillib = {} @@ -41,7 +41,7 @@ function utillib.clamp( val, min, max ) return math.max( min, math.min( val, max ) ) end --- Returns changed value ( value to be changed, index, bit ) +-- Returns changed value ( value to be changed, index, state( bool ) ) function utillib.setBit( v, i, b ) if b then return v | 1 << i @@ -93,6 +93,7 @@ function utillib.round( v ) return math.tointeger( v + 0.5 - ( v + 0.5 ) % 1 ) end +-- Use with dictionary style tables. function utillib.tableLen( t ) local count = 0 @@ -151,4 +152,15 @@ function utillib.toBoolean( v ) return false end +-- Print table content. +function utillib.printt( t ) + print( tostring(t).." = {" ) + + for i, item in pairs( t ) do + print( "\t"..tostring(i).." = "..tostring( item ) ) + end + + print( "}" ) +end + return utillib diff --git a/examples/resources/lib/vector2.lua b/examples/resources/lib/vector2.lua index 7e3b7fb..0446473 100644 --- a/examples/resources/lib/vector2.lua +++ b/examples/resources/lib/vector2.lua @@ -38,7 +38,6 @@ Vector2.meta = { return len end, __eq = function( v1, v2 ) - -- return v1.x == v2.x and v1.y == v2.y return RL_Vector2Equals( v1, v2 ) == 1 end, } diff --git a/examples/resources/lib/vector3.lua b/examples/resources/lib/vector3.lua index 0f4d990..0eb9d77 100644 --- a/examples/resources/lib/vector3.lua +++ b/examples/resources/lib/vector3.lua @@ -38,7 +38,6 @@ Vector3.meta = { return len end, __eq = function( v1, v2 ) - -- return v1.x == v2.x and v1.y == v2.y and v1.z == v2.z return RL_Vector3Equals( v1, v2 ) == 1 end, } |
