aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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>"
{