lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Sep 16, 2016 at 4:51 PM, Charles Heywood <vandor2012@gmail.com> wrote:
I'm pretty sure that wouldn't work but I'm not at a computer to test.


On Fri, Sep 16, 2016, 2:59 PM Soni L. <fakedme@gmail.com> wrote:


On 17/09/16 02:18 AM, Martin wrote:
>
> On 16-09-05 12:29 PM, Soni L. wrote:
>> Lua has 4 forms of negation:
>>
>> -
>> ~
>> not
>> ~=
>>
>> Yet only 2 of them can be overloaded.
>>
>> It's cool that Lua has 4 forms of negation tho.
> As I understand "-" is for general numbers, "~" for integer numbers,
> "not" for general logic and "~=" for equivalence logic. From them only
> "~=" may be dropped and reformulated as "not ==".

What, "~true" isn't a good replacement for "not true"? A boolean has a
single bit so bitwise negation on booleans makes sense...

>
> Also you may count table.insert(), t[#t + 1], "+" and ".." as addition.
>

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.


--


Just tested:

Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
; ~true
stdin:1: attempt to perform bitwise operation on a boolean value
stack traceback:
stdin:1: in main chunk
[C]: in ?
; -true
stdin:1: attempt to perform arithmetic on a boolean value
stack traceback:
stdin:1: in main chunk
[C]: in ?
; not true
false

(that is the standard REPL, I just changed the prompt for convenient copy/paste.)

--
Sent from my Game Boy.