On 9-3-2011 3:41, Ulrike Fischer wrote:
font-dum.lua contains the following code snippet:
local reencodings = { } fonts.enc.reencodings = reencodings
local function specialreencode(tfmdata,value) local encoding = value and reencodings[value] .... end
1. Why is the assignment fonts.enc.reencodings = reencodings and not the other way round?
because it saves a lookup but the reverse works equally well, so consider it a matter of taste
Similar definitions in the same file use more "logical" looking assignments like e.g. "local setups = fonts.protrusions.setups"
2. How does it work? Why is the local table variable "reencodings" in the function specialreencode able to retrieve values stored later in fonts.enc.reencodings?
because we're talking pointers so in t = { } a = t an assignment to a is also an assignment to t ----------------------------------------------------------------- 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 -----------------------------------------------------------------