Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is there a inverse function or anything to a int value if not how to make inverse?

Asked by 5 years ago

For example if a int value is -100 and it touched a part it should turn into positive +100 is there any inverse value in this.?

1
yea, multiply the number by -1 theking48989987 2147 — 5y
0
No inverse function? User#22788 5 — 5y
0
You can easily make your own function using theking's idea Vulkarin 581 — 5y
0
There is a simple way to do this. Use the math.abs function. http://lua-users.org/wiki/MathLibraryTutorial User#25115 0 — 5y
0
If you're using an IntValue, the code would look something like this: iValue.Value = math.abs(iValue.Value). If however, you want the opposite of whether the number is positive or negative, just multiply by -1 as theking said. User#25115 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited by User#24403 5 years ago

No but you can implement your own function.

local function IV(v)
    if type(v) == "number" then
        return v*-1
    end
end

local num = -2
local num = IV(num)
print(num) -- It pritns 2
0
Please use proper indentation in your answers. User#25115 0 — 5y
Ad

Answer this question