Splawsh Posted May 4, 2020 Share Posted May 4, 2020 Hello all I have a problem I want get a line of a file to use in (ex:gg.alert) or other but i only know how get all lines please help me ex: [ /system/build.prop] | [line (7) only] I trying some codes but they didn't work print (" Help me :( ") os.exit() Link to comment Share on other sites More sharing options...
Splawsh Posted May 5, 2020 Author Share Posted May 5, 2020 On 5/4/2020 at 9:04 PM, ItsSC said: you're welcome, if the line is not stable but text has a changing pattern, you can use string.gmatch to find the text you want. OK solve my problem by your help Link to comment Share on other sites More sharing options...
ItsSC Posted May 4, 2020 Share Posted May 4, 2020 file = io.open("/system/build.prop") local number_of_loop = 0 local extracted = {} repeat text = file:read("l*") number_of_loop = number_of_loop + 1 extracted[number_of_loop] = text until number_of_loop == 7 gg.alert(extracted[7]) Simple loop to get seventh line in the file. Link to comment Share on other sites More sharing options...
Splawsh Posted May 4, 2020 Author Share Posted May 4, 2020 35 minutes ago, ItsSC said: file = io.open("/system/build.prop") local number_of_loop = 0 local extracted = {} repeat text = file:read("l*") number_of_loop = number_of_loop + 1 extracted[number_of_loop] = text until number_of_loop == 7 gg.alert(extracted[7]) Simple loop to get seventh line in the file. hey bro very THANKS you❤❤❤ Link to comment Share on other sites More sharing options...
ItsSC Posted May 4, 2020 Share Posted May 4, 2020 3 minutes ago, Splawsh said: hey bro very THANKS you❤❤❤ you're welcome, if the line is not stable but text has a changing pattern, you can use string.gmatch to find the text you want. Link to comment Share on other sites More sharing options...
Question
Splawsh
Hello all
I have a problem
I want get a line of a file to use in (ex:gg.alert) or other
but i only know how get all lines
please help me
ex: [ /system/build.prop] | [line (7) only]
I trying some codes but they didn't work
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.