ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* lpdf.checkedkey has problem with false values
@ 2014-09-15 14:14 Michail Vidiassov
  2014-09-15 14:59 ` Peter Rolf
  0 siblings, 1 reply; 9+ messages in thread
From: Michail Vidiassov @ 2014-09-15 14:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Developers and All,

lpdf.checkedkey routine from lpdf-ini.lua has problems with accessing
false boolean values, it returns them as nil. Is it by design or
neglect?
(I vaguely remember stumbling on this problems before, so  there is a
chance that I have already got the answer, but have forgotten it.)
The minimal demo:
\starttext
\startluacode
local function writebool(bv,text)
 if bv == true then
  io.write(text, " true \n")
 elseif bv == nil then
  io.write(text, " nil  \n")
 else
  io.write(text, " false\n")
 end
end
local a = {}
a["x"] = true
a["y"] = false
a["z"] = nil
writebool(lpdf.checkedkey(a,"x","boolean"),"lpdf.checkedkey(a,\"x\",\"boolean\")")
writebool(lpdf.checkedkey(a,"y","boolean"),"lpdf.checkedkey(a,\"y\",\"boolean\")")
writebool(lpdf.checkedkey(a,"z","boolean"),"lpdf.checkedkey(a,\"z\",\"boolean\")")
writebool(a.x,"a.x")
writebool(a.y,"a.y")
writebool(a.z,"a.z")
\stopluacode
TEST
\stoptext


It results in the following relevant output

lpdf.checkedkey(a,"x","boolean") true
lpdf.checkedkey(a,"y","boolean") nil
lpdf.checkedkey(a,"z","boolean") nil
a.x true
a.y false
a.z nil

Note that false value was read by checkedkey as nil.

Sincerely, MIchail
___________________________________________________________________________________
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] 9+ messages in thread

end of thread, other threads:[~2014-09-16  3:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 14:14 lpdf.checkedkey has problem with false values Michail Vidiassov
2014-09-15 14:59 ` Peter Rolf
2014-09-15 15:34   ` Michail Vidiassov
2014-09-15 15:56     ` Aditya Mahajan
2014-09-15 16:12       ` Michail Vidiassov
2014-09-15 17:12         ` Hans Hagen
2014-09-15 18:25           ` Michail Vidiassov
2014-09-15 19:17             ` Hans Hagen
2014-09-16  3:33               ` Michail Vidiassov

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).