ltf

function ltf( val ) --> func

Description

Creates a function that takes one parameter and compares it with val via the < operator.

Parameters

val

The basic value for the comparsion.

Return Values

func

A new function that takes one parameter and returns true or false.

Code

--ZFUNC-ltf-v1
local function ltf( val ) --> func
   return function ( oth )
      return oth < val
   end
end

return ltf

Examples

local t = require( "taptest" )
local ltf = require( "ltf" )

func = ltf( 2 )

t( func( 3 ), false )
t( func( 2 ), false )
t( func( 1 ), true )

t()

See also