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");