Yet Another Lua Bot |
|
%
Unlike other bots, it can execute more than one version of Lua: everything from 3.2 to 5.3 and even LuaJit.
%<version> <code>
<version>
is, for instance, 5.2
or luajit
. You can leave it blank, and then the default (5.1) is used.
py
, bc
, and even c
. See %list
for a complete list.
<code>
can as well be a pastebin link, in which case the code is pulled from there, making it possible to provide long input for the bot. The current list of pastebins is incomplete, feel free to suggest missing ones.
%
sign, i. e. %%<version> <code>
, the output will be redirected to yalb's own pastebin ring, thus making it possible to also have long output without spamming the channel.
%?<version> <title>
, which looks up a title (like math.sin
, lua_pcall
, or 6.4.1
) in the manual.
The sandbox prints whatever has been returned from the code, but unlike BatBot, it doesn't insert a return
automatically.
There is a function called pp
which is used for pretty-printing. It doesn't perform a deep inspection of tables, but displays identical tables/functions/userdata accordingly.
The sandbox doesn't remove any functions, but a lot of them are rendered useless, e. g. os.execute
returns -1
no matter what, because creating a new process is prohibited.
Execution time is capped at 3 seconds, memory is limited to roughly 45 megabytes.
You are allowed to read files in a few specific locations like /dev/
or /usr/include/
. Other filesystem access, including any kind of write access is forbidden.
Yes, it does take PMs.
Source: The backend is some ptrace mess, [but here it is, anyway]. The front-end is a 80-line Lua script which was hacked together in 15 minutes.
Author: mniip