- Documentation
- Server functions
- createResource
Function
createResource
Creates a new empty resource (a folder with meta.xml) in resources/, optionally in a category such as [maps]. The name may contain letters, digits, _ and -; if such a resource already exists it returns false. The script that created the resource may then write files in it with a ":name/file" path (fileCreate, xmlCreateFile), add entries with addResourceMap / addResourceConfig and delete it with deleteResource. Start the new resource with startResource; on the next server start it starts by itself.
Syntax
resource createResource(string resourceName [, string organizationalPath])Arguments
resourceNamestring- The new resource name.
organizationalPathstring, optional- A subfolder, e.g.
[maps].
Returns
The new resource or false.
Example
local res = createResource("moja_mapa", "[maps]")
local xml = xmlCreateFile(":moja_mapa/moja_mapa.map", "map")
xmlSaveFile(xml)
xmlUnloadFile(xml)
addResourceMap(res, "moja_mapa.map", 0)
startResource(res)