Shared Functions
This page will explain all exported functions from the SonoranCAD Core that can be used on the client and server side
isPluginLoaded
Checks if a specific plugin is loaded by searching through the submodules
table.
submoduleName
string
The name of the submodule to check for in the submodules
table.
shallowcopy
Creates a shallow copy of a table or directly returns non-table values.
orig
any
The value or table to copy. Can be of any type: table, string, number, etc.
stringsplit
Splits a string into substrings based on a specified delimiter.
inputstr
string
The input string that will be split into substrings based on a specified delimiter (sep
)
sep
string
(Optional) If not provided, the default is "%s"
, which matches any whitespace character
findIndex
Searches for a specific identifier in the LocationCache
table and returns the index of the first matching entry.
identifier
any
The identifier to search for, compared against the apiId
field of each entry in LocationCache
.
GetIdentifiers
Extracts and organizes player identifiers into a key-value table format.
player
PlayerSource
The player source ID for whom the identifiers are being retrieved.
PerformHttpRequestS
Simplifies making HTTP requests by providing a wrapper around exports["sonorancad"]:HandleHttpRequest
.
url
string
The URL to which the HTTP request is sent.
cb
function
The callback function executed when the HTTP request completes.
method
string
The HTTP method to use (e.g., GET
, POST
, PUT
, DELETE
).
data
string
(Optional) The data to send with the HTTP request. Defaults to an empty string.
headers
table
(Optional) A table containing custom headers for the HTTP request. Defaults to include X-User-Agent
.
has_value
Checks if a specific value exists in a table.
tab
table
The table to search for the value.
val
any
The value to search for within the table.
compareVersions
Compares two semantic version strings.
version1
string
The first version string (e.g., 1.0.0
).
version2
string
The second version string (e.g., 1.0.1
).
Last updated
Was this helpful?