Math: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (New page: Lua has buildin math functions, that you can use in scripts.  <syntaxhighlight lang="lua"> math.abs    math.acos  math.asin   math.atan  math.atan2  math.ceil math.cos    math.cosh   math.deg    math.exp...) | |||
| (8 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
| Lua  | Math is a built-in Lua library which contains mathematical functions and constants that you can use in scripts. | ||
| * [http://www.lua.org/manual/5.1/manual.html#pdf-math.abs math.abs] | |||
| math.abs  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.acos math.acos] | ||
| math.acos   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.asin math.asin] | ||
| math.asin  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.atan math.atan] | ||
| math.atan   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.atan2 math.atan2] | ||
| math.atan2   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.ceil math.ceil] | ||
| math.ceil | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.cos math.cos]   | ||
| math.cos  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.cosh math.cosh] | ||
| math.cosh  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.deg math.deg] | ||
| math.deg  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.exp math.exp] | ||
| math.exp   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.floor math.floor] | ||
| math.floor   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.fmod math.fmod] | ||
| math.fmod | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.frexp math.frexp] | ||
| math.frexp   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.huge math.huge] (constant) | ||
| math.huge  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.ldexp math.ldexp] | ||
| math.ldexp   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.log math.log] | ||
| math.log  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.log10 math.log10] | ||
| math.log10   | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.max math.max] | ||
| math.max | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.min math.min] | ||
| math.min  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.modf math.modf] | ||
| math.modf  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.pi math.pi] (constant) | ||
| math.pi  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.pow math.pow] | ||
| math.pow  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.rad math.rad] | ||
| math.rad  | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.random math.random] | ||
| math.random | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.randomseed math.randomseed] | ||
| math.randomseed  | |||
| math.sin  | Do this beforehand to improve randomness: | ||
| math.sinh   | <syntaxhighlight lang="lua">math.randomseed(os.time())</syntaxhighlight> | ||
| math.sqrt  | |||
| math.tanh | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.sin math.sin] | ||
| math.tan | * [http://www.lua.org/manual/5.1/manual.html#pdf-math.sinh math.sinh] | ||
| * [http://www.lua.org/manual/5.1/manual.html#pdf-math.sqrt math.sqrt] | |||
| * [http://www.lua.org/manual/5.1/manual.html#pdf-math.tanh math.tanh] | |||
| * [http://www.lua.org/manual/5.1/manual.html#pdf-math.tan math.tan] | |||
| ==See Also== | ==See Also== | ||
| *[http://lua-users.org/wiki/MathLibraryTutorial Math examples on the  | * [http://lua-users.org/wiki/MathLibraryTutorial Math examples on the Lua wiki.] | ||
| [[Category:Scripting Concepts]] | [[Category:Scripting Concepts]] | ||
| [[ar:Math]] | |||
| [[de:Math]] | |||
| [[en:Math]] | |||
Latest revision as of 07:49, 8 June 2024
Math is a built-in Lua library which contains mathematical functions and constants that you can use in scripts.
- math.abs
- math.acos
- math.asin
- math.atan
- math.atan2
- math.ceil
- math.cos
- math.cosh
- math.deg
- math.exp
- math.floor
- math.fmod
- math.frexp
- math.huge (constant)
- math.ldexp
- math.log
- math.log10
- math.max
- math.min
- math.modf
- math.pi (constant)
- math.pow
- math.rad
- math.random
- math.randomseed
Do this beforehand to improve randomness:
math.randomseed(os.time())