Jump to content




Developing for OpenTerminalOS Megathread


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

#1 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 01 June 2015 - 08:49 PM

EDIT: I WILL BE MOVING THIS TO GOOGLE DOCS SOON!

This topic will teach you what you need to know to develop for OpenTerminal. It is a megathread that will contain everything you need to know.

Basics

If there are any issues with the documentation let me know, otherwise all discussion goes on the forum thread here:http://www.computerc...review-edition/ or the subreddit here: http://reddit.com/r/otos.

Edited by cyanisaac, 26 June 2015 - 05:24 PM.


#2 biggest yikes

  • Members
  • 573 posts

Posted 03 June 2015 - 08:40 PM

Apparently S5 will include addons that can be envoked with OTOS.hook, how will this work?
Posted Image

Edited by Atenefyr, 03 June 2015 - 08:41 PM.


#3 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 04 June 2015 - 12:03 AM

View PostAtenefyr, on 03 June 2015 - 08:40 PM, said:

Apparently S5 will include addons that can be envoked with OTOS.hook, how will this work?
Posted Image

At some point I plan on including addons that will let people change the OS drastically. Addons are going to have a lot of control over the operating system. Basically OTOS.hook() will authorize an addon, and it will generate some code to verify that it's allowed to (todo: figure out how to do that).

The reason why OTOS.hook() exists is because I don't want things just being able to go ahead and brute force change how OTOS works - which would allow for malicious scripts o' plenty.

Also in case your curious addons might be the same thing as profiles in ME, I have yet to decide what do with that. Don't get excited about this stuff yet though, it's months away.

Lol I'm removing that from the code too, until I'm ready to approach addons lol.

#4 FUNCTION MAN!

  • Members
  • 292 posts

Posted 06 June 2015 - 12:09 AM

I still don't see the point of OTOS.fetch.

#5 biggest yikes

  • Members
  • 573 posts

Posted 06 June 2015 - 12:59 AM

View PostDr. Poof, on 06 June 2015 - 12:09 AM, said:

I still don't see the point of OTOS.fetch.
You can set the variables (like OTOS.version = "") in S2 and below, but with OTOS.fetch you can't set it (albeit you can override OTOS.fetch to still break stuff)

Edited by Atenefyr, 06 June 2015 - 12:59 AM.


#6 FUNCTION MAN!

  • Members
  • 292 posts

Posted 07 June 2015 - 11:37 PM

Still no point.

--#stuff and things go here, like
_G.otos = {}
otos.version = "mything"
--#after every declaration is done,

local _nativesmt = setmetatable --#override the setmetable function to allow for 'read only' metatables
function _G.setmetatable(t, mt)
   if getmetatable(t) ~= nil and getmetatable(t).isReadOnly then --# is there a read only metatable installed?
	  error('attempt to set metatable of read only table') --# there is?! you can't override it, son
   else
	   return _nativesmt(t, mt) --#there isn't. so we call the native set metatable method to set the metatable of a table
   end
end

setmetatble(otos, { --# set otos' metatable
   ['__newindex'] = function(t,k,v) return end, --# __newindex is the meta-method that controls creation of indexes, effectively making this a read only table
   ['isReadOnly'] = true --# set that read only flag we check for in setmetatable to 'lock down' the metatable
}
--[[
# of course, there are still some disadvantages, such as
# getmetatable(otos).isReadOnly = false, that would allow for the metatable to be overriden
# still, this is better then having to use OTOS.fetch
# of course, you can change the variable name from "otos" to "OTOS" or to "myConfigurationAndStuff", the name is just an example
# you could also wish to make a function to make a table read only
]]--

Edited by Dr. Poof, 07 June 2015 - 11:42 PM.


#7 biggest yikes

  • Members
  • 573 posts

Posted 09 June 2015 - 10:27 PM

View PostDr. Poof, on 07 June 2015 - 11:37 PM, said:

# getmetatable(otos).isReadOnly = false, that would allow for the metatable to be overriden
does not not undermine the purpose?

either way, I think the creator hasn't used metatables before, I sure haven't.

Edited by Atenefyr, 09 June 2015 - 10:28 PM.


#8 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 12 June 2015 - 04:55 AM

I am going to lock this thread for now, I will reopen it when I have actual documentation to show and APIs to showcase. It will be a while. Until then either figure it out yourself by looking in the APIs, or just ask me :)

Edit: Thanks Lyqyd :(

Edited by cyanisaac, 26 June 2015 - 05:25 PM.


#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 12 June 2015 - 06:37 AM

I'm leaving this unlocked as there's no pressing need to lock it only to have to unlock it later.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users