From 0e8eae2a403e7830db242f946fef0d0f6c65722a Mon Sep 17 00:00:00 2001 From: darkf Date: Tue, 17 Dec 2013 01:32:43 -0800 Subject: [PATCH] implement --- irc.lamb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/irc.lamb b/irc.lamb index 7663b48..8b8ad5f 100644 --- a/irc.lamb +++ b/irc.lamb @@ -10,6 +10,11 @@ ADMINS = ["darkf"]. -- channels to join CHANS = ["#lobby"]. +-- the lexical environment that $eval uses +EVAL_ENV = [("loop", loop), + ("repr", repr), + ("itos", itos)]. + -- First we'll define some helper functions map(f, []) -> []. @@ -137,6 +142,12 @@ handleMessage(s, nick, chan, "$savefacts") -> do s end. +handleMessage(s, nick, chan, "$eval "::line) -> do + ret = eval(line, EVAL_ENV); + say(chan, nick + ": " + repr(ret)); + s +end. + handleMessage(s, nick, chan, "$join "::j) -> do if isAdmin(nick) then do fputstr(sock, "JOIN " + j + "\r\n");