-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新文档, 移动 LuaTableBuilder.java 至 api包下
- Loading branch information
Showing
10 changed files
with
128 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
### put | ||
+ **Description**: 增加一个键值对. | ||
+ **Return Type**: **LuaTableBuilder<T>** | ||
+ **Return Desc**: 本实例对象. | ||
+ **Usage**: `put(key:String, value:Object)` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|key|**String**|LuaTable中的键名.| | ||
|value|**Object**|键名对应的值.| | ||
### putAll | ||
+ **Description**: 通过Map增加多个键值对. | ||
+ **Return Type**: **LuaTableBuilder<T>** | ||
+ **Return Desc**: 本实例对象. | ||
+ **Usage**: `putAll(String:Map<?extends, map:?>)` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|String|**Map<?extends**|null| | ||
|map|**?>**|键为字符串类型的map.| | ||
### clear | ||
+ **Description**: 清空当前表. | ||
+ **Return Type**: **LuaTableBuilder<T>** | ||
+ **Return Desc**: 本实例对象. | ||
+ **Usage**: `clear()` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|
||
### remove | ||
+ **Description**: 移除指定键的值. | ||
+ **Return Type**: **LuaTableBuilder<T>** | ||
+ **Return Desc**: 本实例对象. | ||
+ **Usage**: `remove(key:String)` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|key|**String**|要移除的键名.| | ||
### build | ||
+ **Description**: 建立Lua中的表. | ||
+ **Return Type**: **T** | ||
+ **Return Desc**: 返回所建立的表. | ||
+ **Usage**: `build()` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|
||
### buildGlobal | ||
+ **Description**: 建立Lua中的表, 并加入到当前环境的全局变量中. | ||
+ **Return Type**: **void** | ||
+ **Return Desc**: | ||
+ **Usage**: `buildGlobal(key:String)` | ||
|
||
|Name|Type|Description| | ||
|-|-|-| | ||
|key|**String**|全局变量的变量名.| |
2 changes: 1 addition & 1 deletion
2
src/main/java/tk/smileyik/luainminecraftbukkit/api/luaconfig/LuaConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/tk/smileyik/luainminecraftbukkit/api/luatablebuilder/LuaTableBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package tk.smileyik.luainminecraftbukkit.api.luatablebuilder; | ||
|
||
import tk.smileyik.luainminecraftbukkit.util.luaenvironment.LuaEnvironment; | ||
import tk.smileyik.luainminecraftbukkit.util.luaenvironment.LuaEnvironmentInside; | ||
import tk.smileyik.luainminecraftbukkit.util.luaenvironment.LuaEnvironmentOutside; | ||
import tk.smileyik.luainminecraftbukkit.util.luatablebuilder.LuaTableBuilderInside; | ||
import tk.smileyik.luainminecraftbukkit.util.luatablebuilder.LuaTableBuilderOutside; | ||
|
||
import java.util.Map; | ||
|
||
public interface LuaTableBuilder<T> { | ||
static LuaTableBuilder<?> getBuilder(LuaEnvironment<?> luaEnvironment) { | ||
if (luaEnvironment instanceof LuaEnvironmentOutside) { | ||
return new LuaTableBuilderOutside( | ||
(LuaEnvironmentOutside) luaEnvironment); | ||
} else { | ||
return new LuaTableBuilderInside( | ||
(LuaEnvironmentInside) luaEnvironment); | ||
} | ||
} | ||
|
||
/** | ||
* 增加一个键值对. | ||
* @param key LuaTable中的键名. | ||
* @param value 键名对应的值. | ||
* @return 本实例对象. | ||
*/ | ||
LuaTableBuilder<T> put(String key, Object value); | ||
|
||
/** | ||
* 通过Map增加多个键值对. | ||
* @param map 键为字符串类型的map. | ||
* @return 本实例对象. | ||
*/ | ||
LuaTableBuilder<T> putAll(Map<? extends String, ?> map); | ||
|
||
/** | ||
* 清空当前表. | ||
* @return 本实例对象. | ||
*/ | ||
LuaTableBuilder<T> clear(); | ||
|
||
/** | ||
* 移除指定键的值. | ||
* @param key 要移除的键名. | ||
* @return 本实例对象. | ||
*/ | ||
LuaTableBuilder<T> remove(String key); | ||
|
||
/** | ||
* 建立Lua中的表. | ||
* @return 返回所建立的表. | ||
*/ | ||
T build(); | ||
|
||
/** | ||
* 建立Lua中的表, 并加入到当前环境的全局变量中. | ||
* @param key 全局变量的变量名. | ||
*/ | ||
void buildGlobal(String key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters