stendhal/doc/mkdocs/lua/objects/properties.md

76 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2022-01-20 15:36:01 -08:00
2023-05-16 20:13:17 -07:00
---
# Contents
2022-01-20 15:36:01 -08:00
[TOC]
2023-05-16 20:13:17 -07:00
2023-04-21 02:52:49 -07:00
---
2023-05-16 20:13:17 -07:00
# Introduction
2022-01-20 15:36:01 -08:00
2023-04-21 02:52:49 -07:00
Object instance: `properties`
2022-01-20 15:36:01 -08:00
2023-05-16 20:13:17 -07:00
2022-01-20 15:36:01 -08:00
---
2023-05-16 20:13:17 -07:00
## Description
2022-02-28 18:57:37 -08:00
2023-04-21 02:52:49 -07:00
Defines functions for accessing Java system properties.
2023-05-16 20:13:17 -07:00
2023-04-21 02:52:49 -07:00
---
2023-05-16 20:13:17 -07:00
# Methods
2022-01-20 15:36:01 -08:00
---
2023-05-16 20:13:17 -07:00
## poperties:enabled
2023-04-21 02:52:49 -07:00
<div class="function">
2023-05-16 20:13:17 -07:00
properties:enabled <span class="paramlist">(p)</span>
2023-04-21 02:52:49 -07:00
</div>
2022-02-28 18:57:37 -08:00
2022-01-20 15:36:01 -08:00
- Checks if a property is enabed.
- Parameters:
2023-05-16 20:13:17 -07:00
- <span class="param">p:</span> _([string][LuaString])_ Property name.
- Returns: _([bool][LuaBoolean])_ `true` if enabled.
2022-01-20 15:36:01 -08:00
2023-05-16 20:13:17 -07:00
2022-01-20 15:36:01 -08:00
---
2023-05-16 20:13:17 -07:00
## poperties:equals
2023-04-21 02:52:49 -07:00
<div class="function">
2023-05-16 20:13:17 -07:00
properties:equals <span class="paramlist">(p, v)</span>
2023-04-21 02:52:49 -07:00
</div>
2022-02-28 18:57:37 -08:00
2022-01-20 15:36:01 -08:00
- Checks if a property is set to a specified value.
- Parameters:
2023-05-16 20:13:17 -07:00
- <span class="param">p:</span> _([string][LuaString])_ Property name.
- <span class="param">v:</span> _([string][LuaString])_ Value to compare with.
- Returns: _([bool][LuaBoolean])_ `true` if the value of the property is the same as ___v___.
2022-01-20 15:36:01 -08:00
2023-05-16 20:13:17 -07:00
2023-04-21 02:52:49 -07:00
---
2023-05-16 20:13:17 -07:00
## poperties:getValue
2023-04-21 02:52:49 -07:00
<div class="function">
2023-05-16 20:13:17 -07:00
properties:getValue <span class="paramlist">(p)</span>
2023-04-21 02:52:49 -07:00
</div>
- Retrieves the value of a property.
- Parameters:
2023-05-16 20:13:17 -07:00
- <span class="param">p:</span> _([string][LuaString])_ Property name.
- Returns: _([string][LuaString])_ Property value or [nil][LuaNil].
2023-04-21 02:52:49 -07:00
---
2023-05-16 20:13:17 -07:00
# Usage Examples
2022-01-20 15:36:01 -08:00
2023-05-16 20:13:17 -07:00
```lua
2022-01-20 15:36:01 -08:00
-- example of only executing script contents on test server
if not properties:enabed("stendhal.testserver") then
do return end
end
```
2023-04-21 02:52:49 -07:00
[LuaBoolean]: http://luaj.org/luaj/3.0/api/org/luaj/vm2/LuaBoolean.html
[LuaNil]: http://luaj.org/luaj/3.0/api/org/luaj/vm2/LuaNil.html
[LuaString]: http://luaj.org/luaj/3.0/api/org/luaj/vm2/LuaString.html