Jump to content




Quarantine program not functioning

lua

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

#21 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 November 2015 - 07:26 PM

The fs = vfs line is the problem. That's creating an fs table in the current environment rather than replacing the fs table in _G.

#22 ViperLordX

  • Members
  • 43 posts
  • LocationEarth

Posted 07 November 2015 - 10:35 PM

Ah, that makes sense. I'll try it.

Still not working, getting the same exact error at line 16.

#23 valithor

  • Members
  • 1,053 posts

Posted 08 November 2015 - 04:57 AM

View PostViperLordX, on 07 November 2015 - 10:35 PM, said:

Ah, that makes sense. I'll try it.

Still not working, getting the same exact error at line 16.

View Postvalithor, on 07 November 2015 - 05:58 PM, said:

If you use the fix I gave you instead of the one you came up with it would work and would be much more efficient.

Also, when you do eventually switch over to the one I gave you, you will realize you are getting a error on line 65 of edit. In which case you will need to overwrite io.open in the same way you overwrote fs.open.

local oldResolveProgram = shell.resolveProgram

shell.resolveProgram = function(path)
  if oldResolveProgram(path) ~= nil then --# checking if it is nil without the "q/" added on.  Essentially if the path is for rom, or a disk
		return oldResolveProgram(path) --# returning it sense it isn't nil
  else
		return oldResolveProgram("q/"..path) --# returning the "q/" path
  end
end

local oldIoOpen = io.open

io.open = function(path,mode)
  return oldIoOpen(cover(path),mode)
end

Just replace your shell overwrite with this... If it doesn't work then come back and ask for help. It doesn't even appear you have tested it since so you have not said anything about it though I have posted 3 times.

Edited by valithor, 08 November 2015 - 04:59 AM.


#24 ViperLordX

  • Members
  • 43 posts
  • LocationEarth

Posted 08 November 2015 - 06:50 PM

Didn't you admit that I shouldn't overwrite io.open?

#25 valithor

  • Members
  • 1,053 posts

Posted 08 November 2015 - 07:27 PM

View PostViperLordX, on 08 November 2015 - 06:50 PM, said:

Didn't you admit that I shouldn't overwrite io.open?

No... I agreed with them in the respect you shouldn't need to overwrite it, however, with the code you posted here and how you overwrite the fs api it is necessary. If you were to change how you overwrite the fs api then no you shouldn't need to overwrite io.open.

Edit:

Chances are... You just need to fix how you overwrite the fs api, and then you wouldn't need to overwrite anything in shell (the way you overwrote shell caused the too long without yielding error).

Edited by valithor, 08 November 2015 - 07:30 PM.


#26 ViperLordX

  • Members
  • 43 posts
  • LocationEarth

Posted 08 November 2015 - 07:36 PM

Could you explain how it causes the too long without yielding error to me and tell me how to fix it?

Oh, does fs.combine() use shell.resolve() so when I do cover() in shell.resolve(), it calls itself recursively?

Edited by ViperLordX, 08 November 2015 - 07:37 PM.


#27 valithor

  • Members
  • 1,053 posts

Posted 08 November 2015 - 09:17 PM

View PostViperLordX, on 08 November 2015 - 07:36 PM, said:

Could you explain how it causes the too long without yielding error to me and tell me how to fix it?

Oh, does fs.combine() use shell.resolve() so when I do cover() in shell.resolve(), it calls itself recursively?

function hell.resolveProgram(name)
  return hell.resolveProgram(cover(name))
end

That code is taken from what you posted. As you can see it defines hell.resolveProgram, and then the only thing that the function does is call hell.resolveProgram... It is calling itself over and over. It does not crash from the CC recursive limit due to the fact you are returning the function, hence the reason it crashes without too long without yielding.

How to fix it:

Completely remove the shell overwrite, and change the line:

fs = vfs

to

_G.fs = vfs

As lyqyd said.

Just going to say... the fix I posted 3 times actually did fix your problem. Very annoyed you did not even try it, and continued to say your code did not work although I provided a working solution.

Edited by valithor, 08 November 2015 - 09:18 PM.


#28 ViperLordX

  • Members
  • 43 posts
  • LocationEarth

Posted 09 November 2015 - 11:53 PM

I did change it to _G.fs = vfs, and got the same error. I'll try your fix now, I thought I had done shell.resolve instead of hell.resolve.

#29 ViperLordX

  • Members
  • 43 posts
  • LocationEarth

Posted 10 November 2015 - 12:00 AM

Sorry about not trying your code, I didn't try it because I thought it was the same as mine... If you look at the cover() function, it's doing pretty much the same thing. Your way works now, but why? What's the difference?

#30 valithor

  • Members
  • 1,053 posts

Posted 11 November 2015 - 04:38 AM

View PostViperLordX, on 09 November 2015 - 11:53 PM, said:

I did change it to _G.fs = vfs, and got the same error. I'll try your fix now, I thought I had done shell.resolve instead of hell.resolve.

If you change it to _G.fs = vfs, then you must remove the shell overwrite as well. The entire reason the shell overwrite was every needed was because the fs api used in shell.resolveProgram was not being changed (explained by lyqyd). I tested it without the shell overwrite, and it did exactly what you wanted it to do.

View PostViperLordX, on 10 November 2015 - 12:00 AM, said:

Sorry about not trying your code, I didn't try it because I thought it was the same as mine... If you look at the cover() function, it's doing pretty much the same thing. Your way works now, but why? What's the difference?

I am not going to pretend I have a lot of experience with LUA metatables... because I do not. However, if I understand correctly, then overwriting the shell api that way is almost exactly the same as the code below (the test I did also supports this statement):

local hell = {}
hell.resolveProgram = function(...)
  return shell.resolveProgram(cover(...))
end

shell = hell

I think I explained why this won't work earlier, and from my tests this is basically what your overwrite was doing. This is the main difference between our ways of overwriting it.

If you want a better way to overwrite it, then remove the shell overwrite (and io overwrite), and just change that one line. As I admitted in my first post, I did not spend much time actually looking at the code, as I was in class when I made that first post. I just narrowed it down hoping someone else would pick it up and continue to help. As such the solution I provided was aimed at the effect instead of the cause of your problem, so although it works it is not the most efficient way to fix the problem.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users