#Read file lines

1 messages · Page 1 of 1 (latest)

tidal geyser
#

yes it is!

#

i believe theres snippets in #skript-snippets

#

or if you want I can dig around and see if I have any

quaint dome
#

Thanks.

#

Hey couldn't find anything I could understand or give an idea where to start, any chance you for further help ?

#

I should proberly add - Preferably no addon, than skript it self and perhaps skript-reflect please

tidal geyser
#
    java.io.File
    java.util.Scanner
    java.io.FileWriter
    java.nio.file.Files
    java.nio.file.Path

options:
    in: ([with]in|from)

plural expression [all] lines {@in} file %string%:
    return type: strings
    get:
        set {_path} to expr-1

        return ...Files.readAllLines((new File({_path})).toPath())```this is a part of my files stuff, you dont need all the imports for this but if you plan on doing more (ie writing to files too) then you'll need them
quaint dome
#

Your the best, also how do I use it ? I mean can I loop through it and so forth ?

tidal geyser
#

yup, this code just adds the expression, so you can do things like
set {_lines::*} to lines from file "example/file.txt"

quaint dome
#

Thank you so much, last question - How's the performance ?

tidal geyser
#

i dont think you need to worry about that

quaint dome
#

because it's not effecting much, or something else ? - I am using it quite often

#

one more question.. sorry - instead of reading all lines from file, can I just read one line by using the API feature, so I don't have to do it through skript

tidal geyser
#

yes, I've made an expression for that too--ill send it tomorrow

#

(because it actually already is tomorrow for me lol)

tidal geyser