how to replace print function [LUA]

replacement for Msg()

Msg = function(o)
	print(tostring(o).." [leet]")

but such a replacement does not work on print (), how to be?

What’s your code to replace print? And why are you doing that?

What exactly do you want to replace print with? Because I’m 99% sure you’re doing something like: [lua]print = function(msg)
print("Print: "…msg)
end[/lua]In this example, when print is called, it will call itself again, and an infinite loop will be created. To avoid this, you might want to save the original print function into another variable: [lua]local oldPrint = print
print = function(msg)
oldPrint("Print: "…msg)
end[/lua]This should work fine.

But either way, I’d strongly recommend against globally overriding any of the default functions with your own unless you really need that and you fully understand what and why you are doing.

print_old = print_old or print
print = function(...)