Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // the lua
- var vmCode = `local output = {}
- print = function(a)
- table.insert(output,a)
- end
- function organize(t)
- if type(t)=='table' then
- local out = ""
- for i,v in pairs(t) do
- if i>#t-1 then
- out = out.. v
- else
- out = out.. v.. "\\n"
- end
- end
- return out
- else
- return "Failure to organize table."
- end
- end
- `
- // running the lua (put this in the command function thingy)
- async function RunLua(){
- var code = args.slice(1).join(" ")
- var state = new luavm.Lua.State()
- var output = state.execute(vmCode+code+"\nreturn organize(output)")
- embed = new Discord.RichEmbed()
- .setTitle("Success!")
- .setDescription(output.toString())
- .setColor(0x3858f5)
- msg.channel.send(embed)
- }
- RunLua().catch((err)=>{
- embed = new Discord.RichEmbed()
- .setTitle("Lua VM Error")
- .setDescription('```lua\n'+err+'\n```')
- msg.channel.send(embed)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement