Jump to content

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?

@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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...