

sendAll("stand", "wield shield", "say ha!") Use sendAll instead of multiple send commands. echoTheValue optional boolean flag (default value is true) which determine if value should to use multiple send() commands one after another. You can use this to send some things at once instead of having

for using event handlers and parsing its messages into Lua datastructures. A ATCP demo package is also available on the forums Feel free to experiment with this to achieve the desired results. register RoomExits as the event handler, make the script name be process_exits, and use this in the script: For example, if you'd like to listen to the RoomExits event and have it call the process_exits() function. name in the script you'd like to be called. You do that by setting the Script name: to the function should it call for you when your handler receives a message. Next, because scripts in Mudlet can have multiple functions, you need to tell Mudlet which function the event name you'd like your script to listen to into the Add User Defined Event Handler: field and press the + button While the concept of handlers for events is to be explained elsewhere in the manual, the quick rundown is this - place The ATCP handler names follow the same format as the atcp table - RoomNum, RoomExits, CharVitals and so on. If you'd like to trigger on ATCP messages, then you need to create scripts to attach handlers to the ATCP messages. removed - so it becomes CharVitals and RoomExits. Note that while the typical message comes in the format of Module.Submodule, ie Char.Vitals or Room.Exits, in Mudlet the dot is To find out the available messages available in the atcp table and the event names, raised for each ATCP message that arrives. Whenever new data arrives, the previous is overwritten. The latest ATCP data is stored in the atcp table. such that any it should work on others. This is primarily available on IRE-based MUDs, but Mudlet's implementation is generic enough Extending default libraries makes Babelfish happy. tripped up on number representation differences (. You can use the Lua API to bind it, or directly access it via LuaJIT's FFI (recommended).- enforce uniform locale so scripts don't get It also abstracts operating system specific details, much like LuaSocket does. It provides the perfect mix between TCP and UDP: reliable when desired, unreliable otherwise. (LuaJIT supports callbacks if the API requires it however, there is a signficant performance cost compared to polling from Lua to C.) LuaJIT + ENetĮNet is a great library. As for Linux and the rest, look at tutorials for C or the source of LuaSocket and translate them to LuaJIT FFI operations. He's had some very interesting adventures with LuaJIT and Windows development. Lua Lanes would be useful for this as well.įor Windows, I suggest taking a look at William Adam's blog. LuaJIT's FFI library makes this possible from pure Lua. If you're a little masochistic, you can try implementing a socket library from scratch. The results are promising, though you should definitely refactor my example code if you derive from it. It relies on Lua Lanes 3.4.0 ( GitHub repo) and a patched LuaSocket 2.0.2 ( source, patch, blog post re' patch) I've made a simple example of this, available here. This is probably the best solution to your problem. Then, you use a linda to send the data to the main thread for processing. This allows you to instantly read the data from the socket and into a buffer.

Same as the above method, but the socket exists in another lane (a lightweight Lua state in another thread) made using Lua Lanes ( latest source). Lua51/LuaJIT + LuaSocket + Lua Lanes (Recommended) I would suggest using a coroutine scheduler for the non-blocking version, to allow other parts of the program to continue executing without causing too much delay.

