Nmap Development mailing list archives

Re: json library


From: Toni Ruottu <toni.ruottu () iki fi>
Date: Sun, 3 Jul 2011 22:37:39 +0300

Ok. Got it working now. I do not know why I failed the first time.
Sorry for the trouble.

On Sun, Jul 3, 2011 at 10:33 PM, Daniel Miller <bonsaiviking () gmail com> wrote:
forgot to include list, sorry

Dan

---------- Forwarded message ----------
From: Daniel Miller <bonsaiviking () gmail com>
Date: Sun, Jul 3, 2011 at 2:33 PM
Subject: Re: json library
To: Toni Ruottu <toni.ruottu () iki fi>


Toni,

I cannot reproduce. I did a fresh checkout in a separate directory, and the
patch applied correctly with

nmap$ patch -p0 <../json.diff

I've attached it again, in case the first was corrupted in some way.

Dan


On Sun, Jul 3, 2011 at 12:57 PM, Toni Ruottu <toni.ruottu () iki fi> wrote:

For some reason applying the patch fails. Could you try applying it
against a fresh check out to check if you can reproduce the error?

On Fri, Jul 1, 2011 at 8:45 PM, Daniel Miller <bonsaiviking () gmail com>
wrote:
David,

I agree, the original patch was clunky; script writers shouldn't have
to know to set metatables to invoke functionality. The patch I just
attached is better: it introduces two functions, make_array and
make_object, that do the metatable-setting, while preserving any
existing metatable entries. Also, the json.typeof function will return
the JSON type that any variable would be treated as, using both the
metatable and heuristic behaviors. Finally, json.parse will now always
set the proper metatable entries.

Dan

On 7/1/11, David Fifield <david () bamsoftware com> wrote:
On Wed, Jun 29, 2011 at 10:29:20AM -0500, Daniel Miller wrote:
Lua has a built-in way to signal different behaviors: metatables.
Here's a
patch for the json library that checks the metatable for a "json" key.
It
can be set to "array" or "object", to override the default behavior.

This is clever, Daniel. I don't know if it's the best solution, but it
seems all right. Don't forget the other part though--json.parse needs to
set the metatable entries.

David Fifield


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



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

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


Current thread: