コード例 #1
0
        private async Task Lua(CommandReplyEmbed embedrep, SocketMessage msg, List <string> args)
        {
            string        code    = string.Join(',', args);
            List <Object> returns = new List <object>();
            bool          success = LuaEnv.Run(msg, code, out returns, out string error, this.Log);

            if (success)
            {
                string display = string.Join('\t', returns);
                if (string.IsNullOrWhiteSpace(display))
                {
                    await embedrep.Good(msg, "Lua", ":ok_hand: (nil or no value was returned)");
                }
                else
                {
                    await embedrep.Good(msg, "Lua", display);
                }
            }
            else
            {
                await embedrep.Danger(msg, "Lua", error);
            }
        }