Jump to content




This script is not functioning.


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

#1 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 14 August 2015 - 11:52 PM

The following code is not working:

Bootloader Script

Expected Result: It should make the fs api be the vFs api, and backup the old fs api into oldFs. From there it creates a sandboxed environment. Then, it should make sure that the FS api is constantly the same as the vFs api to prevent modification (thus creating a permanently unlocked filesystem).

Actual Result: On ComputerCraft it crashes the computer after lagging for some time, in CCemuredux it crashes the java vm and gives me an out of bounds error and crashes all computers in that session.

Does anyone know what is causing this, and if so, how does one fix this?

#2 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 15 August 2015 - 12:06 AM

Well, for one thing, you can't compare tables with the == operator.

You have to check that manually, using a for loop, that each entry is identical.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 15 August 2015 - 12:08 AM

Well, you can, if you specifically want to check that they're the same table. But yes, checking two different tables to see if they have the same contents is a different process.

local oldFs = fs
local vFs = oldFs -- This is changed for compatibility reasons, to keep the unlocker from being affected as a file.

So fs == oldFs == vFs?

In that case, the function pointers in vFs are identical to those in oldFs (be; eg, when vFs.open tries to call oldFs.open, it ends up calling itself; the new function instance calls itself again, and so on until the function stack overflows (leading to your "out of bounds" error).

If you want to copy the contents of a table into a different table, use a "pairs" loop.

#4 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 15 August 2015 - 01:55 AM

View PostBomb Bloke, on 15 August 2015 - 12:08 AM, said:

Well, you can, if you specifically want to check that they're the same table. But yes, checking two different tables to see if they have the same contents is a different process.

local oldFs = fs
local vFs = oldFs -- This is changed for compatibility reasons, to keep the unlocker from being affected as a file.

So fs == oldFs == vFs?

In that case, the function pointers in vFs are identical to those in oldFs (be; eg, when vFs.open tries to call oldFs.open, it ends up calling itself; the new function instance calls itself again, and so on until the function stack overflows (leading to your "out of bounds" error).

If you want to copy the contents of a table into a different table, use a "pairs" loop.

How would one do this? (sorry, I am still noobish at lua lol)

#5 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 15 August 2015 - 02:14 AM

local oldFs = {}
for k,v in pairs( fs ) do
  oldFs[ k ] = v
end






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users