Jump to content
Splawsh

get a line of a file

Recommended Posts

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()

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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❤❤❤

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 🙂

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...