[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [Proposal] debug.getclosure()? (Was: Re: getinfo for activelines on load/loadstring result)
- From: Andrew Starks <andrew.starks@...>
- Date: Thu, 19 Feb 2015 08:38:56 -0600
On Thursday, February 19, 2015, Soni L. <firstname.lastname@example.org> wrote:
On 19/02/15 09:39 AM, Roberto Ierusalimschy wrote:
Could this be solved by adding something like debug.getclosure(chunk, cl_id)? (and functions to instantiate such a closure?)
Functions in a chunk are only created when you execute the chunk. So,
local b = (loadstring or load)("function a()\n print(1)\n
print(2)\nend\n return a") -- added "return a"
local d = b()
Right, this works, but this is not quite what I'm looking for; this is why
I added "without executing the fragment". The general task is to figure out
the code lines in a file (those that may have breakpoints) without
executing it. I thought that's what activelines gives me, but it doesn't
seem to be the case (or maybe I'm not using it the right way), hence the
while you do not run the fragment, there is no "function a" to be talked
I mean, string.dump DOES dump inner closures, doesn't it?
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.
As far as I can recall, it dumps code that creates a closure, but it is a new closure on every execution (unless it is optimized to be the same closure, but that *should* be transparent).