Created
April 16, 2013 11:59
-
-
Save phi-gamma/5395383 to your computer and use it in GitHub Desktop.
allow overriding of attributes allocation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /tmp/luatex-basics-nod.lua 2013-04-16 13:56:51.387870041 +0200 | |
+++ luatex-basics-nod.lua 2013-04-16 13:57:39.235889616 +0200 | |
@@ -28,21 +28,23 @@ | |
end | |
-attributes = { } | |
+attributes = attributes or { } | |
attributes.unsetvalue = -0x7FFFFFFF | |
local numbers, last = { }, 127 | |
-function attributes.private(name) | |
- local number = numbers[name] | |
- if not number then | |
- if last < 255 then | |
- last = last + 1 | |
+if not attributes.private then | |
+ function attributes.private(name) | |
+ local number = numbers[name] | |
+ if not number then | |
+ if last < 255 then | |
+ last = last + 1 | |
+ end | |
+ number = last | |
+ numbers[name] = number | |
end | |
- number = last | |
- numbers[name] = number | |
+ return number | |
end | |
- return number | |
end | |
-- Nodes: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment