diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-14 14:45:38 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-14 14:45:45 -0700 |
| commit | 7410e42bc00c8438884a475ccf8a9e07b73eaec3 (patch) | |
| tree | fc8bec6c4c2a885aceb75fc784bdc4d07cd5392f /nomsu.lua | |
| parent | 95ee15982bb021e94a4976741a0bcdfe5f5d6992 (diff) | |
Minor optimizations.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -131,12 +131,14 @@ do return self .. stringify(other) end STRING_METATABLE.__index = function(self, i) + local ret = string[i] + if ret ~= nil then + return ret + end if type(i) == 'number' then return string.sub(self, i, i) elseif type(i) == 'table' then return string.sub(self, i[1], i[2]) - else - return string[i] end end end @@ -1103,12 +1105,14 @@ OPTIONS print_err_msg(error_message) return os.exit(false, true) end - local ldt - ok, ldt = pcall(require, 'ldt') - if ok then - ldt.guard(run) - else - xpcall(run, err_hand) + do + local ldt + ok, ldt = pcall(require, 'ldt') + if ok then + ldt.guard(run) + else + xpcall(run, err_hand) + end end end return NomsuCompiler |
