-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06759df
commit 8debb2b
Showing
5 changed files
with
79 additions
and
0 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,21 @@ | ||
#> ashen_lib:string/concat/ | ||
# | ||
# Combine strings, splitting at specified characters | ||
# | ||
# @input storage ashen_lib:api Argument | ||
# CharArray : string[] | ||
# Punctuation : string[] | ||
# @output storage ashen_lib:api | ||
# Return : string | ||
# @api | ||
|
||
# Validate | ||
execute unless data storage ashen_lib:api Argument.CharArray run tellraw @a [{"nbt": "Ashen.Global.Prefix.ERROR", "storage": "global"}, {"translate": "Ashen.Api.Error.Chars", "fallback": "Missing Argument: CharArray"}] | ||
execute unless data storage ashen_lib:api Argument.Punctuation run data modify storage ashen_lib:api Argument.Punctuation set value [""] | ||
|
||
# Exec | ||
execute if data storage ashen_lib:api Argument.CharArray run function ashen_lib:string/concat/core/ | ||
|
||
# Reset | ||
data remove storage ashen_lib:api Argument.CharArray | ||
data remove storage ashen_lib:api Argument.Punctuation |
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,29 @@ | ||
#> ashen_lib:string/concat/core/ | ||
# @within function | ||
# ashen_lib:string/concat/ | ||
# ashen_lib:string/concat/core/ | ||
|
||
# Validate | ||
execute unless data storage ashen_lib:api Return[-1] run data modify storage ashen_lib:api Return[-1] append value "" | ||
|
||
# Get Variable | ||
data modify storage ashen_lib:temp Left set from storage ashen_lib:api Return[-1] | ||
data modify storage ashen_lib:temp Right set from storage ashen_lib:api CharArray[0] | ||
|
||
# Check | ||
scoreboard players set #IsPunc Ashen.Global.Temporary 0 | ||
data modify storage ashen_lib:temp punc set from storage ashen_lib:api Punctuation | ||
execute if data storage ashen_lib:temp punc[0] run function ashen_lib:string/concat/core/check | ||
|
||
# Exec | ||
execute if score #IsPunc Ashen.Global.Temporary matches 1 run data modify storage ashen_lib:api Return append value "" | ||
execute if score #IsPunc Ashen.Global.Temporary matches 0 run function ashen_lib:string/concat/core/concat with storage ashen_lib:api | ||
|
||
# Reset | ||
scoreboard players reset #IsPunc Ashen.Global.Temporary | ||
data remove storage ashen_lib:temp Left | ||
data remove storage ashen_lib:temp Right | ||
|
||
# Loop | ||
data remove storage ashen_lib:api CharArray[0] | ||
execute if data storage ashen_lib:api CharArray[0] run function ashen_lib:string/concat/core/ |
6 changes: 6 additions & 0 deletions
6
data/ashen_lib/functions/string/concat/core/_index.d.mcfunction
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,6 @@ | ||
#> ashen_lib:string/concat/core/_index.d | ||
# @private | ||
|
||
#> Score Holder | ||
# @within function ashen_lib:string/concat/core/** | ||
#declare score_holder #IsPunc |
19 changes: 19 additions & 0 deletions
19
data/ashen_lib/functions/string/concat/core/check.mcfunction
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,19 @@ | ||
#> ashen_lib:string/concat/core/check | ||
# @within function | ||
# ashen_lib:string/concat/core/ | ||
# ashen_lib:string/concat/core/check | ||
|
||
#> Private | ||
# @private | ||
#declare score_holder #Different | ||
|
||
# Check | ||
execute store result score #Different Ashen.Global.Temporary run data modify storage ashen_lib:temp punc[0] set from storage ashen_lib:api CharArray[0] | ||
execute if score #Different Ashen.Global.Temporary matches 0 run scoreboard players set #IsPunc Ashen.Global.Temporary 1 | ||
|
||
# Reset | ||
scoreboard players reset #Different Ashen.Global.Temporary | ||
|
||
# Loop | ||
data remove storage ashen_lib:temp punc[0] | ||
execute if data storage ashen_lib:temp punc[0] run function ashen_lib:string/concat/core/check |
4 changes: 4 additions & 0 deletions
4
data/ashen_lib/functions/string/concat/core/concat.mcfunction
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,4 @@ | ||
#> ashen_lib:string/concat/core/concat | ||
# @within function ashen_lib:string/concat/core/ | ||
|
||
$data modify storage ashen_lib:api Return[-1] set value "$(Left)$(Right)" |