eqf

function eqf( val ) --> func

Description

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

Paramters

val

The basic value for the comparsion.

Return Values

func

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

Code

--ZFUNC-eqf-v1
local function eqf( val ) --> func
   return function ( oth )
      return val == oth
   end
end

return eqf

Examples

local t = require( "tapered" )
local eqf = require( "eqf" )

func = eqf( "foo" )

t.ok( func( "foo" ) )
t.nok( func( "bar" ) )

t.done()

See also