aboutsummaryrefslogtreecommitdiffstats
path: root/alv/init.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-04-20 16:25:39 +0000
committers-ol <s-ol@users.noreply.github.com>2020-04-20 16:45:45 +0000
commit22fa7e3786ff4d5035c6827ed59c3bcf2e49ae53 (patch)
treef54ada7db6958c6b92064b13fff8294336111b64 /alv/init.moon
parentadd wxLua alv-wx (diff)
downloadalive-22fa7e3786ff4d5035c6827ed59c3bcf2e49ae53.tar.gz
alive-22fa7e3786ff4d5035c6827ed59c3bcf2e49ae53.zip
export and export* to create alive modules
See #16
Diffstat (limited to 'alv/init.moon')
-rw-r--r--alv/init.moon20
1 files changed, 12 insertions, 8 deletions
diff --git a/alv/init.moon b/alv/init.moon
index 8b7a01b..f2fed2f 100644
--- a/alv/init.moon
+++ b/alv/init.moon
@@ -9,6 +9,8 @@ if _VERSION == 'Lua 5.1'
error msg
a, msg, ...
+cycle = require 'alv.cycle'
+
version = require 'alv.version'
import Logger from require 'alv.logger'
import ValueStream, EventStream, IOStream from require 'alv.stream'
@@ -21,11 +23,13 @@ import Tag from require 'alv.tag'
import Cell, RootCell from require 'alv.cell'
import program from require 'alv.parsing'
-with require 'alv.cycle'
- \load!
+cycle\resolve!
+
+globals = require 'alv.builtin'
+
+cycle\resolve!
import Copilot from require 'alv.copilot'
-globals = Scope.from_table require 'alv.builtin'
--- exports
-- @table exports
@@ -61,10 +65,10 @@ globals = Scope.from_table require 'alv.builtin'
assert (program\match str), Error 'syntax', "failed to parse"
eval: (str, inject) ->
- scope = Scope nil, globals
- scope\use inject if inject
+ scope = Scope globals
+ scope\use inject if inject
- ast = assert (program\match str), "failed to parse"
- result = ast\eval scope
- result\const!
+ ast = assert (program\match str), "failed to parse"
+ result = ast\eval scope
+ result\const!
}