818 posts
Posted 19 December 2012 - 07:44 AM
Hi again, got a question. My program uses a autoupdater using pastebin. is there any way to make the pastebin program not print all those lines? I could imagine saving print and write to each a variable, then making 2 empty functions called print and write. after I've autoupdated then, I would just set them back. But there got to be a easier way, or is that my best route?
2217 posts
Location
3232235883
Posted 19 December 2012 - 07:50 AM
do
local print=function() end
shell.run("pastebin","stuff")
end
818 posts
Posted 19 December 2012 - 08:06 AM
OK, please motivate doing it like that? How would that make anything better because then i can't print afterwards…
2217 posts
Location
3232235883
Posted 19 December 2012 - 08:08 AM
*facepalm*
thats why i localized it inside a do block >_>
92 posts
Posted 19 December 2012 - 08:09 AM
do
local print=function() end
shell.run("pastebin","stuff")
end
Wouldn't a better way of doing it be like this:
local type = print
local print = function() end
--code
local print = type
Then you can restore print() functionality at the end?
818 posts
Posted 19 December 2012 - 08:09 AM
oh… You didn't put it inside code tags so thought you ment the word do in plain english…
Well.. thanks for the help!
8543 posts
Posted 19 December 2012 - 08:16 AM
do
local print=function() end
shell.run("pastebin","stuff")
end
Wouldn't a better way of doing it be like this:
local type = print
local print = function() end
--code
local print = type
Then you can restore print() functionality at the end?
No. He's got it localized to that do block, so the overridden print goes out of scope at the end of it, automatically restoring print. Your example, by the way, overrides type(), which would not be good.
92 posts
Posted 19 December 2012 - 08:20 AM
do
local print=function() end
shell.run("pastebin","stuff")
end
Wouldn't a better way of doing it be like this:
local type = print
local print = function() end
--code
local print = type
Then you can restore print() functionality at the end?
No. He's got it localized to that do block, so the overridden print goes out of scope at the end of it, automatically restoring print. Your example, by the way, overrides type(), which would not be good.
I didn't know type() was a function, actually. So yeah. But type could be changed for anything. And also, since his code wasn't in
tags, it was kinda confusing because 'do' has more than one meaning when not using the tags
818 posts
Posted 19 December 2012 - 09:22 AM
–snip–