This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
wilcomega's profile picture

Format proposals For Metadata, Programs and API's using settings API

Started by wilcomega, 22 January 2016 - 07:53 AM
wilcomega #1
Posted 22 January 2016 - 08:53 AM
Metadata
SpoilerIntro
So using the settings system in Computer Craft i also thought this might be a way to save metadata
We should save the MetaData to a seperate settings file called .meta and it will have the following format:

Usage

settings.set("path.key", "value")
settings.get("path.key", default)

settings.set("/downloads/myeditor.name", "My Custom Editor")
settings.set("/downloads/myeditor.author", "MEEEEE")

Default values
And i propose we use the following format for these values

string name
string author
string version
string updateURL
string type (executable, api, document)
string format (lua, api, any custom format for your programs)
table times {
	string created
	string changed
}

Of course more meta data can be saved by programs,

Benefits

The main benefit of this method is that the settings API is always there, any program can use it.
and yes some metadata might not exist so an API for this would be usefull but not nececairy.

I am not saying this method is any better than the other ones, but i do like it because it uses a registry like system

Extra

For the update URL i propose it points to a page which contains text deserialize-able by textutils, when done it should havethe following format:

{
	[1] = { -- first version / release
		string version
		string downloadURL
		table dependencies = {
		   { string downloadURL, string filename }
		}
	}
	[2] = { -- update 1.1 or whatever
		string version
		string downloadURL
		table dependencies = {
		   { string downloadURL, string filename }
		}
	}
}

this system for versioning can be used to download a version of the program if ]
If we stick to a format like this, people can build update tools for every program

Programs and API's
Spoiler

Intro
So for programs and api's i propose another format we could all use for finding and installing programs and api's also using the settings API

Format
So in a settings file called programs we should store program info like so

{
	string name
	string author
	string version
	string directory
	string executable
	string fileformat -- the format ID the program can open
}

local program = {
	["name"] = "My Custom Editor"
	["author"] = "ME"
	["version"] = "1.0"
	.....
}
settings.set("ME.MyCustomEditor", program)

And for the Api's is suggest this format:

{
	string name
	string author
	string version
	string loadType (OS, EXE, FUNC) -- how it should be loaded, func should use the string should be executed to load the API
	string loadFunc
}

A serialized table should be saved to the settings file called .apis
oeed #2
Posted 24 January 2016 - 10:18 AM
If you'd like to proposing these standards I'd also recommend posting it on the standards GitHub repo.