Closed MeteorTheLizard closed 4 years ago
Wouldn't it be smarter to find out what is calling it without a table instead of adding a check that should be unnecessary?
Wouldn't it be smarter to find out what is calling it without a table instead of adding a check that should be unnecessary?
Yes, it would be smarter. I've done some debugging and code digging to understand how exactly all of this works and what it is supposed to do and came to the conclusion that the webaudio.CreateStream() function sometimes does not return anything. If I have to guess, since you can spam chatsounds, it creates to many requests which may cause the request to get blocked. I have to note here though that I'm not capable of coding Javascript and can therefor not guarantee that this is actually the issue. Anyway, it seems like this is the best solution for this problem.
Wouldn't it be smarter to find out what is calling it without a table instead of adding a check that should be unnecessary?
Yes, it would be smarter. I've done some debugging and code digging to understand how exactly all of this works and what it is supposed to do and came to the conclusion that the webaudio.CreateStream() function sometimes does not return anything. If I have to guess, since you can spam chatsounds, it creates to many requests which may cause the request to get blocked. I have to note here though that I'm not capable of coding Javascript and can therefor not guarantee that this is actually the issue. Anyway, it seems like this is the best solution for this problem.
The best solution is never to add more workarounds for an issue that should be easily fixable, imagine if you have to do nil checks for all arguments in al ofl your functions because other functions might call it without it's arguments.
Do you check if te arguments is present and if not return, or do you fix the rest of the code?
Looking at my code it looks like it was intended to maybe be undefined, so in a way this is the correct way to do it given the previous code.
However I think I was stupid so instead it's better to create the table once when a sound is created to avoid the need for this check and two other lines of code nearby.
Happened whenever someone spammed "sh" in chat or through saysound, should be fixed with this.