lua-users home
lua-l archive

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


hi there! :)

[continuing the offtopic part only]

Egor Skriptunoff:
> That's why one have to write his own global reference detector

so true! :D however i only made mine when something related came up on
lua-l recently... its very useful! actually the 1st error ive found in
my codes with it was right in itself :D

Sergey Zakharchenko:
> saves oneself the need to maintain a(nother) 1.5k line script

lol, i also got tired when i reached the end of it, but i just skimmed
some more complicated parts of it :D


mine is 83loc with 17 empty and 13 comment lines (that are not all the
comments that it have) so 113 in total. however, only for pretty
printing, there is an inner function with 41 significant lines that i
will refactor, cuz i have a new use case for a part of it. (Abhijit
Nandy, no luck here, im doing such tasks with my bare hands. :D ) this
inner function uses an external string escaper, a `keywords` table;
and the "main" function uses a `table.getSortedKeys()` function and an
output buffer factory for the new, changed and deleted globals, but it
can be used for any other table as well :D

it also have some glue for my app for initializing it before i would
do anything, so i can see more, but thats not required; some to have
buttons for enable/disable it and for enable/disable showing the
changes for same types; and some more for making a "hole" into my main
output buffer (just a matter of inserting an empty string into a
table) run whatever, run this, and put the results into that "hole".
:D but these are kinda tiny stuffs (25loc in total :D )

(11th commandment: “Thou shall not litter.” rip TAD :( )

otherwise mine wont tell where the globals came from, it is a bit
tangled with my app, and it wont do a whole static analysis, that is
actually a good to have, even for modifying it for other purposes, so
its not really a fair comparison... so no offense, Egor, its somewhat
of an apple vs pear comparison! :)

btw some side notes: its invisible if there is nothing to say. the
trim length can be set. it looks a bit weird on the screenshot around
`'\015'`, cuz it wont cut the middle of an escape sequence. the square
brackets shows the previous value, but they are not there if things
changed within the same type. and finally, it was like 13loc (iirc)
when it already worked, and that was very easy, it became a "beast"
when i prettified it, and i still dont have much idea about some
trivial math around the trim, but the tests prove that its right...
X'D


(the file was too big for lua-l)
https://www.dropbox.com/s/acpk3fqub9wn5af/global%20changes.png


bests to all! :)