Library permissions
Permissions library.
Provides an interface to check for access to certain priveleged functions.
Functions
| canPerformAction( action, target ) |
Returns whether your instance has been granted permission to perform the given action. |
| register( rights ) |
Registers a permission request for this instance. |
Fields
Functions
- permissions.canPerformAction( action, target )
-
Returns whether your instance has been granted permission to perform the given action.
Note that this will throw an error if you have not registered the permission first.
Environment:
Shared
Parameters:
-
(string) action: The permission action to check access for.
-
(Player?) target: (Optional) The target player to evaluate the permission against. This is only applicable on the server.
Return value:
(boolean)
True if the instance has been granted this permission, false otherwise.
- permissions.register( rights )
-
Registers a permission request for this instance. You must register permissions in order to be granted them.
All valid permissions are fields on the permissions library table.
Environment:
Shared
Parameters:
-
(string | table) rights: The permission(s) to register (a single value or a list of values).
Usage:
-- Request access to draw halos and play sounds from the internet.
permissions.register( { permissions.DRAW_HALOS, permissions.PLAY_URL_SOUNDS } )