Solved 3 Quick Questions

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

A248

Member
Jan 31, 2017
43
3
8
21
1. Can a function (SkQuery) return a list variable?
code_language.skript:
function getList(path: text, file: text) :: list:
    set {_list::*} to yml list "%{_path}%" of file "%{_file}%"
    return {_list::*}

2. Does deleting a yml path delete all subpaths as well?
code_language.skript:
on load:
    set yml value "Value.First" of file "{@file}" to {first}
    set yml value "Value.Second" of file "{@file}" to {second}
    delete yml value "Value" of file "{@file}" #Does this delete both values specified above?

3. UUID of player returns a text, correct?
code_language.skript:
on join:
    if "%UUID of player%" = UUID of player:
        set join message to "This message will always be broadcasted. &a%name of player% &7joined the game."
    else:
        set join message to "this message will never been seen. &a%name of player% &7joined the game."
 
1. Just put the plural form of the returned type. If you're returning string objects you'd use:
code_language.skript:
function getList(path: text, file: text) :: texts:

    return yml list {_path} of file {_file}

#By the way, this function is utterly useless and pointless. Never do functions for something that's just one line.

2. Yes, it does, you should try it instead of ask.

3. Yes, again, you should try it instead of ask.
 
1. Just put the plural form of the returned type. If you're returning string objects you'd use:
code_language.skript:
function getList(path: text, file: text) :: texts:

    return yml list {_path} of file {_file}

#By the way, this function is utterly useless and pointless. Never do functions for something that's just one line.
Thanks!

I need to return a list for something else, not yml.

So, 'texts' should replace 'list' for the returned type?
 
Status
Not open for further replies.