Square Roots [Solved]
Posted: Fri Sep 16, 2011 11:50 pm
So, lua supports math functions. 5+5, 9/3, was well as trigonomic functions (found in the GC scripts). Is there any way to take the square root of a number/variable?
Code: Select all
number = 5
if number == 5 then
number = sqrt(number)
print(number)
endCode: Select all
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `sqrt' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'[color=#FF8040]lua-users.org/wiki/MathLibraryTutorial math.sqrt examples[/color] wrote:math.sqrt
Return the square root of a given number. Only non-negative arguments are allowed.
- > = math.sqrt(100)
10
> = math.sqrt(1234)
35.128336140501
> = math.sqrt(-7)
-1.#IND