ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* error with table.serialize(environment)
@ 2011-05-18 13:04 Peter Münster
  2011-05-18 14:20 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2011-05-18 13:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

Here a test file "test.cld" to show the problem:

local t = {bla = "blub"}

-- no problem:
print(table.serialize(t))

-- error: l-table.lua:565: unable to dump given function:
print(table.serialize(environment))

context.bye()

-- 
           Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: error with table.serialize(environment)
  2011-05-18 13:04 error with table.serialize(environment) Peter Münster
@ 2011-05-18 14:20 ` Hans Hagen
  2011-05-18 15:49   ` Peter Münster
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2011-05-18 14:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Peter Münster

On 18-5-2011 3:04, Peter Münster wrote:
> Hello,
>
> Here a test file "test.cld" to show the problem:
>
> local t = {bla = "blub"}
>
> -- no problem:
> print(table.serialize(t))
>
> -- error: l-table.lua:565: unable to dump given function:
> print(table.serialize(environment))

to be expected

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: error with table.serialize(environment)
  2011-05-18 14:20 ` Hans Hagen
@ 2011-05-18 15:49   ` Peter Münster
  2011-05-18 16:58     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2011-05-18 15:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hans Hagen <pragma@wxs.nl> writes:

>> -- error: l-table.lua:565: unable to dump given function:
>> print(table.serialize(environment))
>
> to be expected

And what about replacing line 565 by something like this:

        handle(format("%s [%q]=loadstring(%q),",depth,k,
                      debug.getinfo(v).what == "C" and "C code" or dump(v)))

-- 
           Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: error with table.serialize(environment)
  2011-05-18 15:49   ` Peter Münster
@ 2011-05-18 16:58     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2011-05-18 16:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Peter Münster

On 18-5-2011 5:49, Peter Münster wrote:
> Hans Hagen<pragma@wxs.nl>  writes:
>
>>> -- error: l-table.lua:565: unable to dump given function:
>>> print(table.serialize(environment))
>>
>> to be expected
>
> And what about replacing line 565 by something like this:
>
>          handle(format("%s [%q]=loadstring(%q),",depth,k,
>                        debug.getinfo(v).what == "C" and "C code" or dump(v)))

local function dummy() end

local f = getinfo(v).what == "C" and dump(dummy) or dump(v)

handle(format("%s [%q]=loadstring(%q),",depth,k,f))

(and some more places)

or

local f = getinfo(v).what == "C" and dump(function(...) return v(...) 
end) or dump(v)

not that it makes much sense to dump functions

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-18 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 13:04 error with table.serialize(environment) Peter Münster
2011-05-18 14:20 ` Hans Hagen
2011-05-18 15:49   ` Peter Münster
2011-05-18 16:58     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).