Nmap Development mailing list archives

Re: [Lua snippit] print_hex


From: Kris Katterjohn <katterjohn () gmail com>
Date: Sun, 07 Sep 2008 20:44:46 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Patrick Donnelly wrote:
That looks fine. I put the "out" local out of the function definition
to prevent the string from repeatedly being remade (numbers are
constant folded but not strings). I did this mainly to expose people
on the list to some good practices (among other things I did), even
though it probably won't make a huge difference in a debugging
function. If you moved it inside because you didn't want to clutter
the surrounding function (the file) with variables, you can surround
the print_hex function with do ... end to force scoping.

I'm pretty sure Brandon, I and others have brought this up in the past, but it
would be awesome to have a "Best Practices" section (short is fine) in the
Nmap docs/book somewhere on Lua coding, and any gotchas that could get us who
come from many other languages (I think most people here learned Lua solely
for NSE... I know I did).  I know Brandon recently posted a link on learning
Lua from a Perl background, but I've never been much of a Perl guy.

And also anything we can do to make things more efficient.  I don't know how
the Lua interpreter works wrt optimizations or whathaveyou, which is perhaps
another good reason for having some docs on this.

So nothing too broad, just things that can help out specifically on the NSE front.

You obviously seem like a good candidate for writing this, but this is of
course an invitation to anyone who knows Lua well :)

Cheers,


Thanks,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSMSDi/9K37xXYl36AQI3Gg/+O8jjoRxKCF1FPc8romNP83rsmNgvcNJb
Hye7bYOggzYXvF1VF8m2/k9UVBUQR0BDo4Wm+9D+kNcOnXAAhCqX90PWRDlBL/48
220gyeKTi9vJEkBJk19J7ZcONMyqpYCSunDbMGh7hnxGwBbIGu08WPyDq/Bpbzu1
F8nyeBOd/Jk7hclbbpCcmsotG/B8t0JAdSgYVEDEl8k/29h0SnXJye+SkoDZo54O
EMbjS27v+oXnapJDtPTCJaZoKYSW1yQAsGFh+iiLiRbAixKV+IYTtK0j7ajhwca5
kiWphXfVtK62noxmr7Qqj7MvKmdZB1m3Sy3gnh7zhQvH5mozizk9MLVPql6SHVOm
O7SrLYCjrZI9UfCN49vC3QKqQuJ8jsdNbhQXSbQ52N0uRWxz/5qS++o1vaQU82W3
mIZ+ERor2pzR7/6SRNOi+6YZKKMvg4yWXEV5J0tFf7SPVPWvzqBrOwWM9oqsjNYG
pqfKVIg/q9TlOcG3QRrwE3kRkRWDceAs58CdfArTctd7/t69ZfO8mt8WVQcVHUft
hL7WLZ0Iy4aceLn/PE4w7itZ95ML3BKvqVdFMwHq5GDS/6RBOEY1SEBfNXKh4b/o
OsS1PjlrOwLjJb87rp/XlA7TrgFCKVyXBNRGLUanqmZeHShZw8HGj4UGyZhnj3X5
DEgpdyy0/pQ=
=NOYw
-----END PGP SIGNATURE-----

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: