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( "taptest" )
local eqf = require( "eqf" )

func = eqf( "foo" )

t( func( "foo" ), true )
t( func( "bar" ), false )

t()

See also