Page 1 of 1

how to get NIL as a result of a command?

Posted: Fri Aug 11, 2017 10:18 pm
by peceha
Hi,

I'm trying to find a command which can give me NIL as a result.
So far I have found:

Code: Select all

rawGet()
but it doesn't help too much.

I would like to get a NIL instead of 0 from something like this:

Code: Select all

(6<0)
so I thought there could be a command where I can pass this as a argument and get my NIL :)

I want to replace some IFs (a lot) with just comparison to speed up things - unfortunately the result I need is: NIL or something else (that something else means: 1, 1000, "string" or even 0)

example IF to be replaced (if condition is met , the variable "r" is set to something otherwise it is NIL (not 0))

Code: Select all

IF a>0 AND NOT RAWGET(t,0) THEN r=1
Thanks

Re: how to get NIL as a result of a command?

Posted: Fri Aug 11, 2017 10:41 pm
by peceha
EDIT
the condition should look like this:

Code: Select all

IF a>0 AND NOT HAVEITEM(t,0) THEN r=1
and I wanted to replace it with:

Code: Select all

r=a>0 and RAWGET(t,0)
but this will not work when a<0 ( the result in that case is 0 - I need NIL )

Re: how to get NIL as a result of a command?

Posted: Sat Aug 12, 2017 4:02 pm
by peceha
Hi,

sometimes I surprise myself :)
Today I just figured out what I couldn't yesterday:
That's the substitute for my IF statement

Code: Select all

var=(a>0 And RawGet(t,0)) Or RawGet(t,0)

Re: how to get NIL as a result of a command?

Posted: Sat Aug 12, 2017 4:19 pm
by peceha
ups, sorry, wrong answer :(