![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Lua Coding Question within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I decided to place this here as i feel its a better place than the luahelpthread. If i had a ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 | |
![]() ![]() is not posting very often
|
I decided to place this here as i feel its a better place than the luahelpthread.
If i had a settings.ini file, that worked fine but i wanted to make a graphical menu so they can change it on the settings how would i load a line of that code, alter it, save it on the same file, then load it again. i basically need to know how to load and save certain lines from a text file sorry plz delete the other one
__________________
Quote:
|
|
|
|
|
|
|
#3 | |
![]() ![]() is not posting very often
|
well, at least you could do 15% of what i needed lol!
__________________
Quote:
|
|
|
|
|
|
|
#4 |
![]() |
to read
Code:
file = io.open("testRead.txt", "r")
ourtext = file:read()
file:close()
*ourtext is the text from the file to save (write) to a file Code:
file = io.open("testRead.txt","w")
file:write("hello")
file:close()
*"hello" is the text to write to a file All this is from EvilMana.com (it goes into more detail aswell)
__________________
<<Put A message Here>> <<Just made another rubbish website visit it [URL="http://www.joedastudd.co.uk/"]here[/URL].>> |
|
|
|
|
|
#5 | |
![]() ![]() is not posting very often
|
i know that, thats pretty basic, but i wanted just to load the whole thing but only alter certain lines
so i could have like loadlibBase at start = ON and if they click left/right it goes to loadlibBase at start = OFF and in the file its goin from libbase=true to libbase=false and the same happens with every line of that file. i just dont wanna have to make a seperate file for each option.
__________________
Quote:
|
|
|
|
|
|
|
#6 |
![]() ![]() total-Z
|
You load the whole thing, change the line, then save the whole thing.
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#7 | |
![]() ![]() is not posting very often
|
how do u change one line?
__________________
Quote:
|
|
|
|
|
|
|
#8 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#9 | |
![]() ![]() is not posting very often
|
yea, and i bin askin how to do that for this whole thread!
__________________
Quote:
|
|
|
|
|
|
|
#10 |
![]() |
Go here and read this tutorial by Evilmana (PSPMillionaire):
http://evilmana.com/tutorials/lua_tutorial_09.php |
|
|
|
|
|
#11 |
![]() |
I would use: file.read("*l") inside a for loop with a table or if there are only a few lines something like this:
loadlibBase = file.read("*l") someOtherSetting=file.rea d("*l") etc. for every line in the settings.ini file. Aslong as you dont change the order of the lines and the amount, it always reads the right lines (i think)
__________________
LUA manual: [url]http://www.lua.org/manual/5.0/manual.html[/url] LUA Wiki: [url]http://wiki.ps2dev.org/psp:lua_player[/url] |
|
|
|
|
|
#12 | |
![]() ![]() is not posting very often
|
^Thats what i was playing with, havnt made shed loads of progress yet tho.
__________________
Quote:
|
|
|
|
|
![]() |
| Tags |
| coding , lua , question |
| Thread Tools | |
|
|