Jump to content




O


220 replies to this topic

#181 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 05 February 2016 - 12:13 AM

View PostHPWebcamAble, on 04 February 2016 - 11:32 PM, said:

View PostWojbie, on 04 February 2016 - 10:57 PM, said:

How would thing like that translate to CC situation? Could ether of you tell something more about said idea?

Are you referring to a 'hibernate' mode? I think it would be very useful. Put your computer into hibernate mode, and every program stays where it was.
Even if the computer is unloaded, since the data is stored in a file.

Not sure how ram of any sort would help, I'll let cloudninja explain that one.
I mean storing state like that? It sounds impossible from where i am looking at. Most known methods have large problems with how they work.

#182 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 05 February 2016 - 02:30 AM

View PostWojbie, on 05 February 2016 - 12:13 AM, said:

I mean storing state like that? It sounds impossible from where i am looking at. Most known methods have large problems with how they work.
Definitely cannot store what line in a program the computer is at.

#183 ProjectB

  • Members
  • 104 posts
  • LocationCalifornia

Posted 05 February 2016 - 02:39 AM

I don't think what you guys are describing is possible without rewriting ComputerCraft, or at least patching significant portions of the OS.

#184 apemanzilla

  • Members
  • 1,421 posts

Posted 05 February 2016 - 04:17 AM

View PostHPWebcamAble, on 04 February 2016 - 11:32 PM, said:

View PostWojbie, on 04 February 2016 - 10:57 PM, said:

How would thing like that translate to CC situation? Could ether of you tell something more about said idea?

Are you referring to a 'hibernate' mode? I think it would be very useful. Put your computer into hibernate mode, and every program stays where it was.
Even if the computer is unloaded, since the data is stored in a file.

Not sure how ram of any sort would help, I'll let cloudninja explain that one.

AFAIK, that's pretty much impossible. All data types can be serialized, aside from...
  • Native (Java) functions. Can be worked around, but it's not simple.
  • Threads. (AKA coroutines) Not much can be done unless you want to REALLY get hacky and I guess write your own Lua interpreter that CAN serialize threads. Not fun.
So, if you want to implement Lua within Lua, you could get it working, but I highly doubt it will be worth all the effort.

Edited by apemanzilla, 05 February 2016 - 04:19 AM.


#185 Bomb Bloke

    Hobbyist Coder

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

Posted 05 February 2016 - 04:19 AM

View PostCloudNinja, on 04 February 2016 - 09:13 PM, said:

Virtual ram. Ramdisk if you wanna think of it sorta like that.

A RAM disk is kinda the opposite of virtual memory. I think you're thinking of a page file.

#186 Cloud Ninja

  • Members
  • 361 posts

Posted 05 February 2016 - 11:40 AM

View PostBomb Bloke, on 05 February 2016 - 04:19 AM, said:

View PostCloudNinja, on 04 February 2016 - 09:13 PM, said:

Virtual ram. Ramdisk if you wanna think of it sorta like that.

A RAM disk is kinda the opposite of virtual memory. I think you're thinking of a page file.
Yes, thank you, thats what it is. Storing what line of code in a program you're on, pretty much impossible without making every single CC API call refer back to an API you create to tell it what program is running and which line it's on, so you could do it like that but it would require an entire CC API modification.

#187 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 06 February 2016 - 01:36 AM

Spoiler

I would like to believe it IS possible to implement Hibernate in CC.
Though not by saving what line a program is on, or serializing a thread

I can't remember who came up with it, but someone mentioned that you should, in theory, be able to save every event that occurs while a program is running. That would be written to a file to hibernate. To resume, the program is restarted, and each event is queued rapidly.

External factors, like redstone, would also have to be saved, as would the result of any calls to math.random and similar functions.


Like I said, I believe it IS possible. Could take a bit to implement.

#188 apemanzilla

  • Members
  • 1,421 posts

Posted 06 February 2016 - 02:03 AM

View PostHPWebcamAble, on 06 February 2016 - 01:36 AM, said:

Spoiler

I would like to believe it IS possible to implement Hibernate in CC.
Though not by saving what line a program is on, or serializing a thread

I can't remember who came up with it, but someone mentioned that you should, in theory, be able to save every event that occurs while a program is running. That would be written to a file to hibernate. To resume, the program is restarted, and each event is queued rapidly.

External factors, like redstone, would also have to be saved, as would the result of any calls to math.random and similar functions.


Like I said, I believe it IS possible. Could take a bit to implement.

That's not reliable though. Random numbers will be different, for example. It wouldn't work well for turtles either.

The only way you could do it reliably would be to, literally, implement Lua, within Lua, so that you can serialize threads and other objects.

#189 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 06 February 2016 - 02:05 AM

View PostHPWebcamAble, on 06 February 2016 - 01:36 AM, said:

--snip--
Like I said, I believe it IS possible. Could take a bit to implement.
If you are this confident, you should be able to do it yourself.

If/when you get it working (and it is stable), I would LOVE to implement it into my code as an API. Until then, good luck.

Edited by Selim, 06 February 2016 - 02:07 AM.


#190 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 06 February 2016 - 06:38 AM

This is all out of scope for O's featureset though. O isn't trying to reimplement Lua, it's trying to be a simple ComputerCraft shell with a home button.

EDIT: With security

Edited by cyanisaac, 06 February 2016 - 06:38 AM.


#191 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 06 February 2016 - 07:57 AM

View Postapemanzilla, on 06 February 2016 - 02:03 AM, said:

That's not reliable though. Random numbers will be different, for example. It wouldn't work well for turtles either.

View PostHPWebcamAble, on 06 February 2016 - 01:36 AM, said:

External factors, like redstone, would also have to be saved, as would the result of any calls to math.random and similar functions.

View PostSelim, on 06 February 2016 - 02:05 AM, said:

If you are this confident, you should be able to do it yourself.
If ProjectB isn't up to it then I might.

View Postcyanisaac, on 06 February 2016 - 06:38 AM, said:

This is all out of scope for O's featureset though. O isn't trying to reimplement Lua, it's trying to be a simple ComputerCraft shell with a home button.

EDIT: With security
You do have a point.

#192 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 08 February 2016 - 07:08 PM

O gets an error when I run my minimap on it...
lauchpad:94: attempted to perform arithmetic __sub on nil and number
Unfortunately O has crashed!
Press any key to reboot...
It works perfectly fine on regular ol' CraftOS, I'll tell you that.

Edited by LDDestroier, 08 February 2016 - 07:08 PM.


#193 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 08 February 2016 - 07:11 PM

View PostLDDestroier, on 08 February 2016 - 07:08 PM, said:

O gets an error when I run my minimap on it...
lauchpad:94: attempted to perform arithmetic __sub on nil and number
Unfortunately O has crashed!
Press any key to reboot...
It works perfectly fine on regular ol' CraftOS, I'll tell you that.

It may be because a metatable was not coppied when the table was coppied, for example for a sandbox.

#194 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 08 February 2016 - 07:15 PM

View PostCreator, on 08 February 2016 - 07:11 PM, said:

View PostLDDestroier, on 08 February 2016 - 07:08 PM, said:

O gets an error when I run my minimap on it...
lauchpad:94: attempted to perform arithmetic __sub on nil and number
Unfortunately O has crashed!
Press any key to reboot...
It works perfectly fine on regular ol' CraftOS, I'll tell you that.

It may be because a metatable was not coppied when the table was coppied, for example for a sandbox.

Funny, it works when I run multishell first...

#195 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 08 February 2016 - 07:22 PM

View PostLDDestroier, on 08 February 2016 - 07:15 PM, said:

-sniiiiiiip-

Oh, I just figured out the problem. I set a table called 'settings', which conflicts with the settings API. Silly me.

I take it back. It still crashes on startup.

Edited by LDDestroier, 08 February 2016 - 07:23 PM.


#196 ProjectB

  • Members
  • 104 posts
  • LocationCalifornia

Posted 09 February 2016 - 06:16 AM

View PostLDDestroier, on 08 February 2016 - 07:22 PM, said:

View PostLDDestroier, on 08 February 2016 - 07:15 PM, said:

-sniiiiiiip-

Oh, I just figured out the problem. I set a table called 'settings', which conflicts with the settings API. Silly me.

I take it back. It still crashes on startup.

Incompatibility was caused due to the bottom bar using a global variable that your 'map' program was overwriting. This issue has been patched in O2.5.2. This update is on it's way to being deployed.

Edited by ProjectB, 09 February 2016 - 07:02 AM.


#197 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 09 February 2016 - 01:19 PM

View PostProjectB, on 09 February 2016 - 06:16 AM, said:

View PostLDDestroier, on 08 February 2016 - 07:22 PM, said:

View PostLDDestroier, on 08 February 2016 - 07:15 PM, said:

-sniiiiiiip-

Oh, I just figured out the problem. I set a table called 'settings', which conflicts with the settings API. Silly me.

I take it back. It still crashes on startup.

Incompatibility was caused due to the bottom bar using a global variable that your 'map' program was overwriting. This issue has been patched in O2.5.2. This update is on it's way to being deployed.

Great, now it works just fine! Although it was probably avoidable if (back when I first started writing it) I used...any local variables.

#198 LewisTehMinerz

  • Members
  • 174 posts
  • LocationMinecraft in Minecraft in Minecraft in ComputerCraft... in Minecraft

Posted 23 February 2016 - 07:10 PM

This operating system destroyed my bootloader that I spent ages on writing.

10/10.

Please add a check to the installer that checks if you already have a startup file instead of overwriting it... I spent ages writing that bootloader you know, and I've just lost all of the data.

Edited by LewisTehMinerz, 23 February 2016 - 07:12 PM.


#199 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 23 February 2016 - 09:32 PM

View PostLewisTehMinerz, on 23 February 2016 - 07:10 PM, said:

This operating system destroyed my bootloader that I spent ages on writing.

10/10.

Please add a check to the installer that checks if you already have a startup file instead of overwriting it... I spent ages writing that bootloader you know, and I've just lost all of the data.

And kids, that is why you backup your data! Seriously, GitHub/pastebin are there for a reason.

#200 SGunner2014

  • Members
  • 113 posts
  • LocationMaidstone, UK

Posted 23 February 2016 - 11:53 PM

View PostLewisTehMinerz, on 23 February 2016 - 07:10 PM, said:

This operating system destroyed my bootloader that I spent ages on writing.

10/10.

Please add a check to the installer that checks if you already have a startup file instead of overwriting it... I spent ages writing that bootloader you know, and I've just lost all of the data.

You installed an OS. What did you expect?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users