aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-11-01 09:45:33 +0000
committers-ol <s-ol@users.noreply.github.com>2018-11-01 09:45:33 +0000
commitb1ea3892278adee65111b5e07b612a72dce1b019 (patch)
tree4b361d3ec658f921b265689d49cbd27356ea2545 /lib
parentMerge branch 'root-mmmfs' (diff)
downloadmmm-b1ea3892278adee65111b5e07b612a72dce1b019.tar.gz
mmm-b1ea3892278adee65111b5e07b612a72dce1b019.zip
defer all scripts
Diffstat (limited to 'lib')
-rw-r--r--lib/init.client.moon3
-rw-r--r--lib/init.server.moon5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/init.client.moon b/lib/init.client.moon
index 77ff0ee..144543b 100644
--- a/lib/init.client.moon
+++ b/lib/init.client.moon
@@ -44,3 +44,6 @@ relative = do
_require name
on_client = (f, ...) -> f ...
+
+if on_load
+ for f in *on_load do f!
diff --git a/lib/init.server.moon b/lib/init.server.moon
index 198c64e..cc3851d 100644
--- a/lib/init.server.moon
+++ b/lib/init.server.moon
@@ -46,7 +46,10 @@ on_client = (fn, ...) ->
-- warn code
"<script type=\"application/lua\">
local fn = #{compile fn}
- fn(#{table.concat [string.format '%q', v for v in *args ], ', '})
+ on_load = on_load or {}
+ table.insert(on_load, function()
+ fn(#{table.concat [string.format '%q', v for v in *args ], ', '})
+ end)
</script>"
{