This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
Release dev/0.4.1-dev
- Fixed an issue whenever you pass nothing to a function instead of a string it will crash the server.
getResourceFromName
renamed togetResourceByName
.Resource.getFromName
renamed toResource.getByName
.- Add the possibility to read both
server.cfg
andresource.cfg
files. There is a global object calledserverConfig
(it will return auserdata:Config
type) which you can access everywhere and can read keys from the config file withgetKey(string key)
function. For resource objects you can access it byconfig
property orgetConfig()
function (also in each resource there is a variable calledlocalResource
which is an object for the current resource the script is running in).
Examples:
print(serverConfig:getKey("announce"))
print(serverConfig:getKey("name"))
print(serverConfig:getKey("description"))
print(inspect(serverConfig:getKey("resources")))
print(inspect(serverConfig:getKey("modules")))
print(localResource.config)
print(localResource.config:getKey("main"))
print(inspect(localResource:getConfig():getKey("required-permissions")))
print(import("resourcename").config:getKey("main")) --import is just an alias for getResourceByName
print(import("resourcename"):getConfig():getKey("main")) --import is just an alias for getResourceByName
print(inspect(Resource.getByName("resourcename"):getConfig():getKey("test-value"))) --you can also access unique keys as well
print(inspect(getResourceByName("resourcename"):getConfig():getKey("test-value"))) --you can also access unique keys as well
print(inspect(getResourceByName("resourcename").config:getKey("test-value"))) --you can also access unique keys as well