Jump to content

Parse chat messages on server side


Recommended Posts

Sorry,  wrong Subforum, this topic must be in Dont Starve Together.

 

Anyway i found solution by placing this code in modmain.lua

GLOBAL.Networking_Say = function(guid, userid, name, prefab, message, colour, whisper, ...)        print(message)end
Is this right way to do this or not?
This code does not overwrite main function, which resides in networking.lua?
Link to comment
Share on other sites

@wbykos That would in fact overwrite the original function. You can preserve the original by assigning it to another variable and calling it.

local old_Networking_Say = GLOBAL.Networking_Say -- preserve old function-- OverwriteGLOBAL.Networking_Say = function(guid, userid, name, prefab, message, colour, whisper)	local r = old_Networking_Say(guid, userid, name, prefab, message, colour, whisper) -- Call old function		print(message) -- Do what you need		return r -- Return value from old functionend
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...