Resources: Difference between revisions

no edit summary
No edit summary
No edit summary
 
Line 36: Line 36:




== Meta File ==
== Meta.xml File ==
Here is an example for the contents of the meta file:
This is used to provide some basic information and what scripts/files it provides.<br>
{{XMLCode|1=<meta>
'''All resources must have a meta.xml, or the resource won't load!'''
<info author="jack9267" type="script" version="1.0.0" description="Provides something awesome." />
 
<script src="server.lua" type="server" language="lua" />
</meta>}}
 
The info element contains who made the script, the type of script and the version of the script.<br>


You would have a script element for each script file you wish to load, each with a "type" attribute that refers to what side the script will run on (server or client), a language attribute that tells the server/client which language the script file uses (see [[ScriptingLanguages|supported scripting languages]]), and a "src" attribute with the file name as a relative path (i.e. "example.js" or "foo/bar.js".
Example
 
Below is a list of all accepted meta.xml nodes.
{{XMLCode|1=<meta>
{{XMLCode|1=<meta>
<info author="" type="" version="" description="" />
<info author="" type="" version="" description="" />
Line 56: Line 48:
<file url="" src="" type=""  />
<file url="" src="" type=""  />
</meta>}}
</meta>}}
Some notes:
* All "src" attributes are a relative path to the file, with the resource's folder as the root. See the "Sandbox" section above for more info on that.
* The <code>info</code> node contains attributes that indicates who made the resource, it's type (custom description), custom version number, and a description of the resource<br>
* Every script file needs to have a <code><script></code> node, each with a "type" attribute that refers to what side the script will run on (server or client), a language attribute that tells the server/client which language the script file uses (see [[ScriptingLanguages|supported scripting languages]]), and a "src" attribute with the file name as a relative path (i.e. "example.js" or "foo/bar.js".
* Every custom file needs to have a <code><file></code> node, each with a "src" attribute for the file's path, and a "type" attribute indicating whether it's for the client or server.
* Any <code><dependency></code> node, with a "src" attribute with the other resource's name, will require the other resource to be loaded BEFORE this one.


== Client-side Files ==
== Client-side Files ==
2,756

edits