garrysmod icon indicating copy to clipboard operation
garrysmod copied to clipboard

Simplified tobool

Open mastopgunaf opened this issue 5 years ago • 12 comments

mastopgunaf avatar Aug 22 '20 23:08 mastopgunaf

imo you just made it confusing

EmperorSuper avatar Aug 22 '20 23:08 EmperorSuper

return !( val == nil || val == false || val == 0 || val == "0" || val == "false" ) or return val != nil && val != false && val != 0 && val != "0" && val != "false"

anything else makes little sense

neico avatar Aug 23 '20 09:08 neico

It's better to get rid of C keywords.

GitSparTV avatar Aug 23 '20 11:08 GitSparTV

bruh

ExtReMLapin avatar Aug 24 '20 15:08 ExtReMLapin

bruh

If I omit the "not not", it will return nil if it's given a nil instead of false, so not not has to be there. No bruh.

mastopgunaf avatar Aug 24 '20 15:08 mastopgunaf

Use @neico's second solution, it's the easiest to read.

Kefta avatar Aug 24 '20 18:08 Kefta

Use @neico's second solution, it's the easiest to read.

Imagine using C operators in GMod in 2020... Why would you?

mastopgunaf avatar Aug 24 '20 18:08 mastopgunaf

Hello, As I feel like we will not agree on what to do, I decided to compile it to Lua 5.1 bytecode. You can now load the bytecode using this interpreter :

https://raw.githubusercontent.com/Rerumu/Rerubi/master/Source.lua bytecode.out

ExtReMLapin avatar Aug 24 '20 18:08 ExtReMLapin

@mastopgunaf Because it's the accepted style of the codebase at the moment. We can evaluate changing it all in the future, but for now, stick with the common style or this won't be accepted.

Kefta avatar Aug 24 '20 19:08 Kefta

@mastopgunaf Because it's the accepted style of the codebase at the moment. We can evaluate changing it all in the future, but for now, stick with the common style or this won't be accepted.

I changed it to those terrible operators, should be ok now.

mastopgunaf avatar Aug 25 '20 16:08 mastopgunaf

The double ! is still unreadable, but whatever I guess.

Kefta avatar Aug 25 '20 16:08 Kefta

What is this meant to achieve?

robotboy655 avatar Aug 02 '22 14:08 robotboy655