Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add for loops with vars.toml #117

Open
MysteryBlokHed opened this issue Aug 11, 2021 · 0 comments
Open

Add for loops with vars.toml #117

MysteryBlokHed opened this issue Aug 11, 2021 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed preprocessor Related to the preprocessor

Comments

@MysteryBlokHed
Copy link
Owner

Adding preprocessor for loops (sort of like if/else statements in #108) that iterate over values from the vars.toml file would mean an easier way of customizing some aspects of a datapack. For example, if you wanted users to be able to provide a list of commands, then add something before each of those, you could have a vars.toml file like this:

commands = [
    "say Hello, World!",
    "say Example",
]

And code like this:

!for $cmd in commands
    execute if tvar run_something matches 1 run $cmd
!end

Which would compile to:

execute if tvar run_something matches 1 run say Hello, World!
execute if tvar run_something matches 1 run say Example
@MysteryBlokHed MysteryBlokHed added enhancement New feature or request preprocessor Related to the preprocessor labels Aug 11, 2021
@MysteryBlokHed MysteryBlokHed added this to the Databind 0.7 milestone Aug 11, 2021
@MysteryBlokHed MysteryBlokHed removed this from the Databind 0.7 milestone Aug 23, 2021
@MysteryBlokHed MysteryBlokHed added the help wanted Extra attention is needed label Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed preprocessor Related to the preprocessor
Projects
None yet
Development

No branches or pull requests

1 participant