Chat-bots in Lua ================ TinyBrain (TinyBrain.de) now offers a way of creating a chat-bot (a program you can talk to) using very simple Lua code. Software installation required on your machine: none. All you need is a browser. Your chat-bots will be available on the Internet instantly. To create a chat-bot, upload a snippet of Lua code to the TinyBrain snippets database (http://tinybrain.de:8080/tb/). Choose type "Lua code - Chat-bot" and make the snippet public by ticking the appropriate checkbox. Remember the snippet's ID, e.g. #123 and enter the ID on the front page (http://tinybrain.de). That's all! How to write the code ===================== You'll get the user's last input in the variable "input". So a simple, stateless bot can look like this: return(input == "" and "Say something!" or "You just said: "..input) Yes, that's only one line of code. :) Stateful bots ============= Of course it is nice to have the bot remember something between user lines. To do this, use the "cookies" table, which is a Lua map (with string keys and string values). Here's an example from snippet #27 (http://tinybrain.de/27): if input ~= "" and cookies.name == nil then cookies.name = input end if cookies.name then return("Hello "..cookies.name.."!") else return "What's your name?" end Yes, that's all. btw, the cookies are totally persistent - even between server restarts. Sandbox ======= The Lua scripts run in a very tight sandbox. There is literally nothing "bad" you can do, not even writing endless loops. If you write more complex examples, you'll probably need more Lua libraries (only very few functions are available in the sandbox right now). If you have such a need, just write a mail (stefan.reich.maker.of.eye@gmail.com). Cheers! -Stefan