diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-15 15:21:32 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-15 15:22:03 -0700 |
| commit | 28cd9ae0b7a09d8f2cd0cd929f1ebdce4b081502 (patch) | |
| tree | 9b306517621da0ecbc824c68382044515581d8ef /nomsu_tree.lua | |
| parent | ae979c3718b6b472148a19f64aa3e0878e1e259d (diff) | |
More API cleanup, and fixed a bug with optimized lua files generating
spurious circular import errors.
Diffstat (limited to 'nomsu_tree.lua')
| -rw-r--r-- | nomsu_tree.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nomsu_tree.lua b/nomsu_tree.lua index 1fd1687..1132dac 100644 --- a/nomsu_tree.lua +++ b/nomsu_tree.lua @@ -801,15 +801,17 @@ Tree("Number", { end }) Tree("Var", { - as_lua = function(self, nomsu) - local lua_id = "_" .. (self.value:gsub("%W", function(verboten) - if verboten == "_" then + as_lua_id = function(v) + return "_" .. (v:gsub("%W", function(c) + if c == "_" then return "__" else - return ("_%x"):format(verboten:byte()) + return ("_%x"):format(c:byte()) end end)) - return Lua.Value(self.source, lua_id) + end, + as_lua = function(self, nomsu) + return Lua.Value(self.source, self.as_lua_id(self.value)) end, as_nomsu = function(self, inline) if inline == nil then |
