Miscellaneous handy goodies
#9
(12-28-2022, 01:44 AM)grymmjack Wrote: I will return to this to explain but mostly this is self-explanatory stuff.

If I were offering this code to other people I'd turn all those % into &&, and give a better name to that ln$ and change the input parameter type to && instead of !. This is so that it's useful with any integer type. What if you needed pretty-print for an _INTEGER64?

Also I prefer the "value&& * (-1)" instead of "-value&&" that somebody else proposed. It clearly explains what is going on. But then again this is a "toolbox" not meant for beginners trying to learn BASIC programming.

I was going to write something else just above but the following works, does give me -5 in Lua:

Code: (Select All)
value = 5
print(-value)

Those metatables are as slick as the programmer wants them to be...
Reply


Messages In This Thread
Miscellaneous handy goodies - by grymmjack - 12-28-2022, 01:44 AM
RE: Miscellaneous handy goodies - by grymmjack - 12-28-2022, 01:46 AM
RE: Miscellaneous handy goodies - by SMcNeill - 12-28-2022, 03:55 AM
RE: Miscellaneous handy goodies - by madscijr - 12-28-2022, 11:56 PM
RE: Miscellaneous handy goodies - by OldMoses - 12-28-2022, 01:41 PM
RE: Miscellaneous handy goodies - by mdijkens - 12-28-2022, 03:37 PM
RE: Miscellaneous handy goodies - by mnrvovrfc - 03-27-2023, 06:22 PM
RE: Miscellaneous handy goodies - by aurel - 04-02-2023, 05:01 PM



Users browsing this thread: 4 Guest(s)