Posted 16 November 2017 - 04:25 PM
I was trying to one-up nago with a chatbox-based command interpreter that would have modular commands that could run asynchronously upon activation, so that followup input could be read. However, I cannot get that to work. Right now it just hangs until you reboot with CTRL+R. How do I do this?
Link to pastebin: https://pastebin.com/ECeJ3CpL
Let me explain its intended action.
Instances of commands being ran are stored in the userActions table. When any external command is ran (found in "/chatcommand/cmd/"), it will create a coroutine of a function of that command being ran with the first argument being the user who ran the command, and the rest being an arbitrary amount of extra arguments. When a command is done executing, it's supposed to be removed automatically from the userActions table. A person would chat a command, then it would look for all external commands and check too see if the user command matched. Failing that, it would check the internal ones instead.
Of course, none of that happens, because it hangs immediately. It doesn't return a "too long without yield" though.
If I get this to work, this could be my big chance to learn the ins and outs of coroutines, and I could make new, wonderful things!
Link to pastebin: https://pastebin.com/ECeJ3CpL
Let me explain its intended action.
Instances of commands being ran are stored in the userActions table. When any external command is ran (found in "/chatcommand/cmd/"), it will create a coroutine of a function of that command being ran with the first argument being the user who ran the command, and the rest being an arbitrary amount of extra arguments. When a command is done executing, it's supposed to be removed automatically from the userActions table. A person would chat a command, then it would look for all external commands and check too see if the user command matched. Failing that, it would check the internal ones instead.
Of course, none of that happens, because it hangs immediately. It doesn't return a "too long without yield" though.
If I get this to work, this could be my big chance to learn the ins and outs of coroutines, and I could make new, wonderful things!