Am 15.09.2014 um 16:14 schrieb Michail Vidiassov: > 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?
More a lua design decision. 'nil' is equal to 'false' here, 'true' is equal to all that is not 'nil'. http://www.lua.org/pil/3.3.html > (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 if bv then > io.write(text, " true \n") > elseif bv == nil then else (if not bv then) HTH, Peter > 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 > ___________________________________________________________________________________ > ___________________________________________________________________________________ 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 ___________________________________________________________________________________