of     2   
chevron_rightchevron_rightchevron_right

CaptainGector
#198036795Wednesday, September 07, 2016 11:45 PM GMT

... I'm sure it's simple, but I have an excuse! I haven't been scripting all summer :)
CaptainGector
#198036859Wednesday, September 07, 2016 11:46 PM GMT

Of course, I mean aside from a series of if statements checking to see if it's greater than 0, preferably.
instawin
#198036860Wednesday, September 07, 2016 11:46 PM GMT

if num < 0 then
[rfa#hidefromsearch]
#198036868Wednesday, September 07, 2016 11:46 PM GMT

[rfa#hidefromsearch]
CaptainGector
#198037085Wednesday, September 07, 2016 11:49 PM GMT

Oh, there isn't a math.positive or something? I must be dumber then I thought...
ThomasChabot
#198037167Wednesday, September 07, 2016 11:51 PM GMT

If you're trying to get only positive numbers, you can do that using math.abs (x). But as for just checking if something's under 0, there's no better method than the if If you're seeing this post, it means I'm either dead (leaving behind a very fabulous looking corpse) or my soul has been captured by pixies!
Casualist
#198037541Wednesday, September 07, 2016 11:56 PM GMT

local math = {}; setmetatable(math,{__index = getfenv().math}) math.positive = function(num) return num > 0 end print(math.positive(-10)) There you go OP
lordrambo
#198037605Wednesday, September 07, 2016 11:57 PM GMT

well the definition of a negative number is a number below 0, so the simplest form to translate that to would be: if num < 0 thats almost no bloat at all considering you will need an if statement either way and evaluation of that condition will take almost no time at all since it'll only generate like one instruction plus the conditional jump in the assembly dump
KillerKyle
#198037909Thursday, September 08, 2016 12:01 AM GMT

# ###### that is negative, is less then 0. Simple.
Wowgnomes
#198040913Thursday, September 08, 2016 12:46 AM GMT

local numb = math.random(-500,500) if math.sqrt(numb*numb) == numb then print("positive it's positive") else print("positive its negitive") end
thedailyblarg
#198040968Thursday, September 08, 2016 12:47 AM GMT

local isPositive = -1<0 print(isPositive)
thedailyblarg
#198041045Thursday, September 08, 2016 12:48 AM GMT

*-1>0 or you can use this function sign(x) return (x0 and 1) or 0 end
thedailyblarg
#198041201Thursday, September 08, 2016 12:51 AM GMT

and when you use a comparison operator like =, , ==, ~=, they will all return true or false so you can skip using if statements if you dont want to
Wowgnomes
#198041337Thursday, September 08, 2016 12:53 AM GMT

nice, didn't know that!
thedailyblarg
#198041382Thursday, September 08, 2016 12:53 AM GMT

well @OP doesnt know that apparently so you dont need that sarcasm
cntkillme
#198041464Thursday, September 08, 2016 12:55 AM GMT

blarg you're a stupid arrogant skid, stop assuming things and stop acting like you're some kind of genius when time and time again you show that you're incredibly dumb.
thedailyblarg
#198041522Thursday, September 08, 2016 12:56 AM GMT

yet you take the time to be one of the most mentally damaged people on this forum by arguing with individuals for stating things in a better way than you
cntkillme
#198041577Thursday, September 08, 2016 12:57 AM GMT

> says the one who explained the dot product wrong (and countless other topics) > says the one who explains anything to do with programming wrong > says the one who tries to act superior you're not good at this.
Wowgnomes
#198041893Thursday, September 08, 2016 1:02 AM GMT

I wasn't being sarcastic, I did not know that operators did not need if statements.
TimeTicks
#198041949Thursday, September 08, 2016 1:02 AM GMT

IsNegative = function(num) return num < 0 and true or false end) print(IsNegative(-1)) >> true
cntkillme
#198042057Thursday, September 08, 2016 1:04 AM GMT

You don't need the "and true or false" time.
Casualist
#198042194Thursday, September 08, 2016 1:06 AM GMT

@wowgnomes the way the and//or keywords work allow them to behave similarly to ternary operators of other languages. The first result from googling "lua Ternary" will provide you with a nice explanation of how it all works// how it behaves logically
Wowgnomes
#198042988Thursday, September 08, 2016 1:17 AM GMT

Thanks!
thedailyblarg
#198046269Thursday, September 08, 2016 2:14 AM GMT

flux thinks that being a bully to people does not make him look superior in retrospect it makes him look like an immature idiot who has nothing better to do
cntkillme
#198046442Thursday, September 08, 2016 2:17 AM GMT

Nah, I only bully people who deserve to be bullied. AKA arrogant ###### and people who have too much of an ego and are stubborn and refuse to acknowledge themselves as wrong when they are wrong. Like you, for example.

    of     2   
chevron_rightchevron_rightchevron_right