Is expression library
local Is = require('__stdlib__/stdlib/utils/is')
Is.True(true)
Is.Not.True(false)
Is.Assert.True(true)
Is.Assert.Not.True(false)
| Table(var) | Returns the var if the passed variable is a table. |
| String(var) | Returns the var if the passed variable is a string. |
| Number(var) | Returns the var if the passed variable is a number. |
| Nil(var) | Returns true if the passed variable is nil. |
| Boolean(var) | Returns true if the passed variable is a boolean. |
| True(var) | Returns true if the passed variable is true |
| Truthy(var) | Returns the var if the passed variable is not nil or false. |
| False(var) | Returns true if the passed variable is false. |
| Falsy(var) | Returns true if the passed variable is false or nil. |
| Empty(var) | Returns true if the passed variable is nil, an empty table, or an empty string. |
| Positive(var) | Returns the passed var if it is positive. |
| odd(var) | Returns the passed var if it is odd. |
| even(var) | Returns the passed var if it is even. |
| Negative(var) | Returns the passed var if it is negative. |
| NaN(var) | Returns the passed var if it is not a number. |
| Finite(var) | Returns the passed var if it is finite. |
| Int(var) | Returns the passed var if it is an int. |
| Int8(var) | Returns the passed var if it is an int8. |
| Int16(var) | Returns the passed var if it is an int16. |
| Int32(var) | Returns the passed var if it is an int32. |
| Unsigned(var) | Returns the passed var if it is an unsigned int. |
| UInt(var) | Returns the passed var if it is an unsigned int. |
| UInt8(var) | Returns the passed var if it is an unsigned int8. |
| UInt16(var) | Returns the passed var if it is an unsigned int16. |
| UInt32(var) | Returns the passed var if it is an unsigned int32. |
| Float(var) | Returns the passed var if it is a float. |
| Position(var) | Returns the passed var if it is a full position. |
| Area(var) | Returns the passed var if it is a full area. |
| Vector(var) | Returns the passed var if it is a simple position/vector. |
| BoundingBox(var) | Returns the passed var if it is a simple area/boundingbox. |
| Hex(var) | Returns the hex value of the passed var if it is hexadecimal. |
| StrictWord(var) | Returns true if the passed variable is a single alphbetical word. |
| AlphabetWord(var) | Returns true if the passed variable is a single alphbetical word. |
| AlphanumWord(var) | Returns true if the passed variable is a single alphbetical word. |
| Object(var) | Is this a factorio object |
| Valid(var) | Is this factorio object valid |
| Callable(var) | Returns true if the passed variable is a callable function. |
| Is | Is the test true. |
| Is(var) | Is the test truthy |
| Not(var) | Is the test not truthy |
| Assert(var) | Assert that the test is Truthy |
| Assert.Not(var) | Assert that the test is not Truthy |
Returns the var if the passed variable is a table.
Parameters:
Returns the var if the passed variable is a string.
Parameters:
Returns the var if the passed variable is a number.
Parameters:
Returns true if the passed variable is nil.
Parameters:
Returns true if the passed variable is a boolean.
Parameters:
Returns true if the passed variable is true
Parameters:
Returns the var if the passed variable is not nil or false.
Parameters:
Returns true if the passed variable is false.
Parameters:
Returns true if the passed variable is false or nil.
Parameters:
Returns true if the passed variable is nil, an empty table, or an empty string.
Parameters:
Returns the passed var if it is positive.
Parameters:
Returns the passed var if it is odd.
Parameters:
Returns the passed var if it is even.
Parameters:
Returns the passed var if it is negative.
Parameters:
Returns the passed var if it is not a number.
Parameters:
Returns the passed var if it is finite.
Parameters:
Returns the passed var if it is an int.
Parameters:
Returns the passed var if it is an int8.
Parameters:
Returns the passed var if it is an int16.
Parameters:
Returns the passed var if it is an int32.
Parameters:
Returns the passed var if it is an unsigned int.
Parameters:
Returns the passed var if it is an unsigned int.
Parameters:
Returns the passed var if it is an unsigned int8.
Parameters:
Returns the passed var if it is an unsigned int16.
Parameters:
Returns the passed var if it is an unsigned int32.
Parameters:
Returns the passed var if it is a float.
Parameters:
Returns the passed var if it is a full position.
Parameters:
Returns the passed var if it is a full area.
Parameters:
Returns the passed var if it is a simple position/vector.
Parameters:
Returns the passed var if it is a simple area/boundingbox.
Parameters:
Returns the hex value of the passed var if it is hexadecimal.
Parameters:
Returns true if the passed variable is a single alphbetical word.
Does not allow any special chars
Parameters:Returns true if the passed variable is a single alphbetical word.
Allows _ and – as part of the word
Parameters:Returns true if the passed variable is a single alphbetical word.
Must start with a letter, allows _ and – as part of the word
Parameters:Is this a factorio object
Parameters:
Is this factorio object valid
Parameters:
Returns true if the passed variable is a callable function.
Parameters:
Is the test true.
Fields: