luvit

Attempt to call field 'contains' (a nil value) | How can I check the table to see if it has a server?

纵然是瞬间 提交于 2019-12-25 09:02:13
问题 What I am trying (Discord Bot) is to make a command called !say serverID channelID arg The point of this command is that I will pm the bot with this command and the bot writes the arg in the defined channelID from the server. Library (litcord) : https://github.com/satom99/litcord A part of the code (Yes, this has issues...) : local server = client.servers:getAll('id', serverID) if server then if server.contains('id', serverID) then for _, serverID in pairs(server) do if serverID == serverID

How do I make require() take a direct path to a file

做~自己de王妃 提交于 2019-12-10 23:32:52
问题 so I have the following code, and the problem is that when I loop through each file in my array and try to require the file path, it gives me an error of the module isn't found. local Commands = {} function getCommands() local readdir = fs.readdir local readdirRecursive = require('luvit-walk').readdirRecursive readdirRecursive('./Desktop/Discord/ArtifexBot/Discordia/resources/commands/', function(k, files) for i,v in pairs(files) do if v:match(".lua") and not v:match("commands.lua") then

Streaming stdout to a web page

萝らか妹 提交于 2019-12-07 22:13:28
问题 This seems like it should be a really simple thing to achieve, unfortunately web development was never my strong point. I have a bunch of scripts, and I would like to launch them from a webpage and see the realtime stdout text on the page. Some of the scripts take a long time to run so the normal single response isn't good enough (I have this working already). As far as I can see, my options are stdout to a file, and periodically (every couple of seconds) send a request from the client and

Streaming stdout to a web page

房东的猫 提交于 2019-12-06 04:41:38
This seems like it should be a really simple thing to achieve, unfortunately web development was never my strong point. I have a bunch of scripts, and I would like to launch them from a webpage and see the realtime stdout text on the page. Some of the scripts take a long time to run so the normal single response isn't good enough (I have this working already). As far as I can see, my options are stdout to a file, and periodically (every couple of seconds) send a request from the client and respond with the contents of this file. Chunked HTTP responses? I'm not sure if this is what they are