diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-10 22:47:03 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-10 22:47:18 -0700 |
| commit | 4126589afef1c3c14cfa5a3a0f43cc6e98569f1d (patch) | |
| tree | 3a6aee67f531c76f2b979f4b81cba5fc53b3fc6e /core/operators.nom | |
| parent | 77c11a2443adb883621b4253d63fe40db048bd85 (diff) | |
Cleanup: removed "File" type trees (now just Block), overhauled
how_do_i.nom, added "result of %" macro, which allowed comprehensions to
be way more concisely defined. Moved len() operator into the nomsu
environment.
Diffstat (limited to 'core/operators.nom')
| -rw-r--r-- | core/operators.nom | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/core/operators.nom b/core/operators.nom index 706909c..56e89cb 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -163,14 +163,8 @@ immediately # Unary operators compile [- %] to: Lua value "(- \(% as lua expr))" compile [not %] to: Lua value "(not \(% as lua expr))" - compile [length of %list] to - # A bit of a hack so that luajit works properly. - Lua value ".." - (function(l) - local mt = getmetatable(l); - if mt and mt.__len then return mt.__len(l) end - return #l - end)(\(%list as lua expr)) + # Using custom "len()" instead of Lua's "#" operator for compatibility with luajit. + compile [length of %list] to: Lua value "len(\(%list as lua expr))" # Update operators immediately |
