AclSave: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Added an example.) |
||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
<!-- Explain what the example is in a single sentance --> | <!-- Explain what the example is in a single sentance --> | ||
This example | This example saves the ACL when somebody types "/save-acl". | ||
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --> | <!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function saveACL ( thePlayer, command ) -- Function header. Also where thePlayer is defined. | ||
local saved = aclSave() -- Save the ACL | |||
if ( saved ) then -- If it was successfully saved then... | |||
outputChatBox ( "ACL was successfully saved.", source, 255, 0, 0 ) -- Output it saved | |||
else -- If it wasn't saved for whatever reason then... | |||
outputChatBox ( "An unexpected error occured.", source, 255, 0, 0 ) -- Output it didn't save | |||
end | |||
end | |||
addCommandHandler ( "save-acl", saveACL ) -- Make it trigger for "/save-acl". | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --> | <!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --> | ||
{{ACL_functions}} | {{ACL_functions}} | ||
Revision as of 19:57, 23 February 2010
This function saves the ACL from the memory back to the XML file. That must be done after changing the ACL so your changes are remembered for the next server restart. This does not need to be done after every change, but after you're done changing it.
Syntax
bool aclSave ()
Returns
Returns true if the ACL was successfully changed, false or nil if it could not be saved for some reason, ie. file in use.
Example
This example saves the ACL when somebody types "/save-acl".
function saveACL ( thePlayer, command ) -- Function header. Also where thePlayer is defined. local saved = aclSave() -- Save the ACL if ( saved ) then -- If it was successfully saved then... outputChatBox ( "ACL was successfully saved.", source, 255, 0, 0 ) -- Output it saved else -- If it wasn't saved for whatever reason then... outputChatBox ( "An unexpected error occured.", source, 255, 0, 0 ) -- Output it didn't save end end addCommandHandler ( "save-acl", saveACL ) -- Make it trigger for "/save-acl".
See Also
- aclCreate
- aclCreateGroup
- aclDestroy
- aclDestroyGroup
- aclGet
- aclGetGroup
- aclGetName
- aclGetRight
- aclGroupAddACL
- aclGroupAddObject
- aclGroupGetName
- aclGroupList
- aclGroupListACL
- aclGroupListObjects
- aclGroupRemoveACL
- aclGroupRemoveObject
- aclList
- aclListRights
- aclReload
- aclRemoveRight
- aclSave
- aclSetRight
- hasObjectPermissionTo
- isObjectInACLGroup