Changes

Jump to navigation Jump to search

math.eval

58 bytes added, 22:01, 19 April 2016
m
no edit summary
Line 1: Line 1:  
<span style="font-weight: bold;">math.eval</span> is a math library extension. <br />
 
<span style="font-weight: bold;">math.eval</span> is a math library extension. <br />
 +
 +
{{Since|3.0}}
 +
    
The function calls the math server with the specified arguments and returns the a numerical result if possible.<br>  
 
The function calls the math server with the specified arguments and returns the a numerical result if possible.<br>  
Line 10: Line 13:  
'''Example''' : To evaluate ''f1'' for a given value in x, the parameter x must be converted to a string, and then any embedded "e" must be replaced with Unicode character U+F000. <br />
 
'''Example''' : To evaluate ''f1'' for a given value in x, the parameter x must be converted to a string, and then any embedded "e" must be replaced with Unicode character U+F000. <br />
   −
<source lang="lua">local mx = tostring(x):gsub("e", string.uhar(0xF000))
+
<source lang="lua">local mx = tostring(x):gsub("e", string.uchar(0xF000))
 
local expr = "f1(" .. mx .. ")"
 
local expr = "f1(" .. mx .. ")"
 
return math.eval(expr)</source>  
 
return math.eval(expr)</source>  
Line 33: Line 36:  
== See also ==
 
== See also ==
 
[[math.evalStr]]
 
[[math.evalStr]]
 +
 +
 +
[[Category:Extended_Standard_Library]]

Navigation menu