Bence2004 Posted June 25, 2020 Share Posted June 25, 2020 Segítség kéne. local datum = "2020-02-10" -- ez kéne így: local datum = {2020, 02, 10} -- output megoldás vagy függvénynév? Link to comment
WorthlessCynomys Posted June 25, 2020 Share Posted June 25, 2020 local example = "an example string" for i in string.gmatch(example, "%S+") do print(i) end -- output: -- an -- example -- string Annyi a dolgod, hogy a gmatch stringjét átírod. Szerintem ha a gmatch-nek "-"-t adsz meg értéknek, akkor jól fogja felbontani. Aztán tömmbe rakod. Link to comment
Bence2004 Posted June 25, 2020 Author Share Posted June 25, 2020 (edited) - t ad vissza mindig megvan köszi! for i in string.gmatch("2020-20-22", "%d+") do table.insert(asd, i) end Edited June 25, 2020 by Bence2004 Link to comment
Hexon Posted June 27, 2020 Share Posted June 27, 2020 Talán itt van egy egyszerűbb megoldás (számomra biztosan egyszerűbb): local datumString = "2020-02-10" local datumArray = split(datumString, "-") print(datumArray[1], datumArray[2], datumArray[3]) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now