User Tools

Site Tools


modding:function:eval

eval

eval

eval

Syntax (eval expr) → value of evaluated expression
Arguments expression: The thing you want to evaluate. It can handle numbers, function, strings, and lists. What it does, depends on what argument it gets.
Returns If it is passed a number or lamdba function it just returns that otherwise tries to run the list as a function and returns what that function returns, or if it is a string it returns the value of the variable with that name.
Category function operator, string operator, variable
Description Returns the evaluated expression. If it is passed a number or function it just returns that if it is a list tries to run the list as a function and return what it returns, or if it is a string it returns the value of the variable with that name.

Example

(eval '(add 1 1))

This is a list case. This will return the number 2.

(block (varies)
	(setq varies "I am a variable")
	(eval "varies")
	)

This is a string case. This will return the string “I am a variable”.

(eval (add 1 1))

Even though it is similar to the list case this is a number case (the (add 1 1) is run first). This will return the number 2.

(eval add)

This is the function case. This will return the function add. Return to Functions list

modding/function/eval.txt · Last modified: 2014/12/27 04:40 by 127.0.0.1