Jump to content




Overwriting printing in pastebin?


  • You cannot reply to this topic
8 replies to this topic

#1 Doyle3694

  • Members
  • 815 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?

#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 19 December 2012 - 07:50 AM

do
local print=function() end
shell.run("pastebin","stuff")
end

#3 Doyle3694

  • Members
  • 815 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...

#4 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 19 December 2012 - 08:08 AM

*facepalm*
thats why i localized it inside a do block >_>

#5 digpoe

  • Members
  • 92 posts

Posted 19 December 2012 - 08:09 AM

View PostPixelToast, on 19 December 2012 - 07:50 AM, said:

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?

#6 Doyle3694

  • Members
  • 815 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!

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 19 December 2012 - 08:16 AM

View Postdigpoe, on 19 December 2012 - 08:09 AM, said:

View PostPixelToast, on 19 December 2012 - 07:50 AM, said:

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.

#8 digpoe

  • Members
  • 92 posts

Posted 19 December 2012 - 08:20 AM

View PostLyqyd, on 19 December 2012 - 08:16 AM, said:

View Postdigpoe, on 19 December 2012 - 08:09 AM, said:

View PostPixelToast, on 19 December 2012 - 07:50 AM, said:

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 [code] tags, it was kinda confusing because 'do' has more than one meaning when not using the tags

#9 Doyle3694

  • Members
  • 815 posts

Posted 19 December 2012 - 09:22 AM

--snip--





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users