Garry's Mod

Garry's Mod

EasyChat
party 26 Feb, 2022 @ 12:20am
EasyChat + Roll the dice = script errors
@Earu here is the script error from the roll the dice addon https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1893133643

[EasyChat] lua/includes/modules/utf8.lua:0: stack overflow
1. force - lua/includes/modules/utf8.lua:309
2. ExtendedStringTrim - lua/easychat/easychat.lua:82
3. say_override - lua/easychat/networking.lua:546
4. Say - lua/easychat/networking.lua:570
5. fn - lua/autorun/server/rtd.lua:39
6. Run - lua/ulib/shared/hook.lua:109
7. SendGlobalMessage - lua/easychat/networking.lua:73
8. ReceiveGlobalMessage - lua/easychat/networking.lua:215
9. say_override - lua/easychat/networking.lua:555
10. Say - lua/easychat/networking.lua:570
11. fn - lua/autorun/server/rtd.lua:39
12. Run - lua/ulib/shared/hook.lua:109
13. SendGlobalMessage - lua/easychat/networking.lua:73
14. ReceiveGlobalMessage - lua/easychat/networking.lua:215
15. say_override - lua/easychat/networking.lua:555
16. Say - lua/easychat/networking.lua:570
< >
Showing 1-4 of 4 comments
Earu  [developer] 17 Mar, 2022 @ 12:40pm 
Hey!
I know the error looks like it comes from EasyChat but it does really seem like this addon is using the chat wrong. And by that I mean using the functionalities of the chat wrong. Which is why it also breaks EasyChat naturally.
BotLiquor 7 Feb, 2024 @ 10:39pm 
Is there a fix for it because I've got lua issues too
Bonesnake 8 Feb, 2024 @ 12:56am 
Hi there! I'm the creator of the RtD addon. I've looked at both source codes and it seems like this is an unfortunate side effect of RtD resending the trigger command and EasyChat trimming player messages.

RtD intercepts the trigger message and resends it manually to preserve the order of operations, ie:
1. Player writes !rtd to chat
2. Something random happens
3. Feedback is sent to the player's chatbox about the roll's outcome

This would normally create an infinite loop, because the hook triggers and the function resends the command continuously. To prevent this, the function appends an extra space after the message (so that it no longer matches the command on the next call and returns immediately).

I haven't looked at EasyChat's code extensively, but if I'm right, it trims the extra space after the command and causes the mentioned stack overflow as a side effect. I might be able to fix it by using a different method for preventing this loop.

I'll look at this in the coming days and report back about the success. Until then, I'd appreciate @Eapy if you could check it and confirm if my assumption is correct about EasyChat trimming messages. Either way, this change should be an improvement to RtD, but I hope this will also fix the issue.
Bonesnake 10 Feb, 2024 @ 9:36am 
I've just published an update for RtD that should make it work with EasyChat.
< >
Showing 1-4 of 4 comments
Per page: 1530 50