Jump to content




Replace parts of _G not working.


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

#1 PixelFox

  • Members
  • 106 posts

Posted 01 August 2015 - 07:53 PM

So, I'm working on a program that turn shell.run() into something else, and _G.lol into shell.run()

The code I have is:
_G.lol = _G.shell.run
_G.shell.run = function()
   print("Testing Testing 1 2 3")
end

Edited by Lightning, 01 August 2015 - 07:54 PM.


#2 Lignum

  • Members
  • 558 posts

Posted 01 August 2015 - 08:10 PM

So... what's the problem? This should work fine.

#3 PixelFox

  • Members
  • 106 posts

Posted 01 August 2015 - 08:14 PM

It doesn't work for some reason.

#4 PixelFox

  • Members
  • 106 posts

Posted 01 August 2015 - 08:20 PM

Wait, Fixed it.

#5 flaghacker

  • Members
  • 655 posts

Posted 01 August 2015 - 08:28 PM

Also, you can remove every single _G in that program.

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 01 August 2015 - 08:46 PM

A big part of the reason this wouldn't have worked is because the shell "API" isn't a real API, and therefore is not found in _G. It's an interface exposed to programs running under and individual shell instance.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users