ZH-CN/aclSave: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> The ACL XML file is automatically save...") |
Qwe7769611 (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
{{Server function}} | {{Server function}} | ||
<!-- Describe in plain english what this function does. Don't go into details, just give an overview --> | <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> | ||
每当修改ACL时,ACL XML文件都会自动保存,但出于性能原因,自动保存最多可延迟10秒。调用此函数将强制立即保存. | |||
== | ==语法== | ||
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --> | <!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool aclSave () | bool aclSave () | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN|This function is a static function underneath the ACL class.|[[ACL]].save||}} | ||
=== | ===返回值=== | ||
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --> | <!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --> | ||
如果ACL已成功更改,则返回“true”;如果由于某种原因(如文件正在使用)无法保存,则返回“false”或“nil”. | |||
== | ==示例== | ||
<!-- Explain what the example is in a single sentance --> | <!-- Explain what the example is in a single sentance --> | ||
此示例在有人键入“/save ACL”时保存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 saveACL ( thePlayer, command ) -- 函数标题.也是定义图层的地方 | ||
local saved = aclSave() -- | local saved = aclSave() -- 保存ACL | ||
if ( saved ) then -- | if ( saved ) then -- 如果成功保存,则... | ||
outputChatBox ( "ACL was successfully saved.", thePlayer, 255, 0, 0 ) -- | outputChatBox ( "ACL was successfully saved.", thePlayer, 255, 0, 0 ) -- 输出已保存 | ||
else -- If it wasn't saved for whatever reason then... | else -- If it wasn't saved for whatever reason then... | ||
outputChatBox ( "An unexpected error occured.", thePlayer, 255, 0, 0 ) -- | outputChatBox ( "An unexpected error occured.", thePlayer, 255, 0, 0 ) -- 输出它没有保存输出 | ||
end | end | ||
end | end | ||
addCommandHandler ( "save-acl", saveACL ) -- | addCommandHandler ( "save-acl", saveACL ) -- 使其触发“/save-acl” | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 33: | Line 33: | ||
<!-- 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}} | ||
[[ | [[en:aclSave]] |
Latest revision as of 07:13, 6 February 2021
每当修改ACL时,ACL XML文件都会自动保存,但出于性能原因,自动保存最多可延迟10秒。调用此函数将强制立即保存.
语法
bool aclSave ()
OOP 语法 什么是OOP?
- 提示: This function is a static function underneath the ACL class.
- 方法: ACL.save(...)
返回值
如果ACL已成功更改,则返回“true”;如果由于某种原因(如文件正在使用)无法保存,则返回“false”或“nil”.
示例
此示例在有人键入“/save ACL”时保存ACL.
function saveACL ( thePlayer, command ) -- 函数标题.也是定义图层的地方 local saved = aclSave() -- 保存ACL if ( saved ) then -- 如果成功保存,则... outputChatBox ( "ACL was successfully saved.", thePlayer, 255, 0, 0 ) -- 输出已保存 else -- If it wasn't saved for whatever reason then... outputChatBox ( "An unexpected error occured.", thePlayer, 255, 0, 0 ) -- 输出它没有保存输出 end end addCommandHandler ( "save-acl", saveACL ) -- 使其触发“/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