File: eval.lua

package info (click to toggle)
swift-im 2.0%2Bdev6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,456 kB
  • ctags: 15,521
  • sloc: cpp: 86,078; python: 1,431; xml: 546; sh: 263; ansic: 54; makefile: 42
file content (14 lines) | stat: -rw-r--r-- 450 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

function eval_command(command, params, message)
   assert(loadstring(params))()
   swiftob_reply_to(message, "done")
end

function evalr_command(command, params, message)
   result = assert(loadstring(params))()
   swiftob_reply_to(message, "" .. result)
end

swiftob_register_command("eval", "Owner", "Evaluate an expression", eval_command)
swiftob_register_command("evalr", "Owner", "Evaluate an expression and return the result", evalr_command)