Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von HaxxBlaster I am just asking if there is a "return" command that really works, i know everything else. ...
-
05-08-2006, 12:25 PM #2161Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Well you could have made that clear
Zitat von HaxxBlaster

-
05-08-2006, 12:29 PM #2162QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I pretty much did, because there is no other way to do the "skipp" stuff that i want.
Dosen't any one know how the "return" commands works?Geändert von HaxxBlaster (05-08-2006 um 12:37 PM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 12:55 PM #2163QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I got this "Loop In Gettable" problem as well, and i can't find anything thats wrong with the script.
I have tryed "Do wile true" and it dosen't work.
I also hav etryed to take away parts to see if it work, but nothing fhcking work!
Code:---- FILETYPE CHOOSER FTime:start() if pad:l() and filetype == ".png" and FTime:timer() >= 400 then FTime:reset() filetype = ".jpg" screen.waitVblankStart(ControlWait) end if pad:l() and filetype == ".jpg" and FTime:timer() >= 400 then FTime:reset() filetype = ".png" screen.waitVblankStart(ControlWait) end ---- PAD:R() SHOW LAST SAVE if pad:r() and ShowLastSave == false and FTime:timer() >= 500 then while true do ShowLastSave = true FTime:reset() end end if pad:r() and ShowLastSave == true and FTime:timer() >= 500 then ShowLastSave = false FTime:reset() end
Yes, same error with both button hits.Geändert von HaxxBlaster (05-08-2006 um 01:15 PM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 12:57 PM #2164
- Registriert seit
- May 2006
- Beiträge
- 2
- Points
- 3.974
- Level
- 40
- Downloads
- 0
- Uploads
- 0
here is the code thats make 2 buttons to one fuction
if pad:cross() and
square() then
break
end
[I]end[I/]
-
05-08-2006, 01:01 PM #2165QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Hehe, yes i know. But read my code before posting.
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 01:14 PM #2166QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
not really a lua question.. but how do you make an image transparent.. and can you do it in MS paint?
-
05-08-2006, 01:52 PM #2167Developer

- Registriert seit
- Oct 2005
- Ort
- Boston, MA
- Beiträge
- 1.389
- Points
- 14.378
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Hey TO, search in google for "Lumo PSP" i think he has a sidescrolling example code.
No, use something like Photoshop, or the Gimp.
Zitat von montrob
When u rub something out in these programs the BG shows(grey and white squares), that shows that it is transparent.
-
05-08-2006, 02:02 PM #2168Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Alright thanks a lot
Zitat von Vaza

-
05-08-2006, 02:17 PM #2169
TO, you can also use the "music" example in the "Applications" folder in LUA-player itself. It has a scrolling background. Also I use a very simple way of scrolling, well i think so anyway, but im not sure if thats the same. It'll probably come down to the same.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-08-2006, 03:37 PM #2170
I have a little Problem:
Money = 300
Bet = 0
Code:if pad:right() and oldpad:right() ~= pad:right() then Bet = Bet + 10 end if pad:left() and oldpad:left() ~= pad:left() then Bet = Bet - 10 end if Bet < 0 then Bet = 0 end if Bet > Money then Bet = Money end
when i lose the money cause down up to zero how can i do so that it goes down only onece.Same thing when i win but it goes up.Code:function pointsCalculate() if Points == Dealerpoints then screen:blit(0,0,lose) Money =- Bet elseif Points > Dealerpoints then screen:blit(0,0,win) Money =+ Bet elseif Points == 11 and Dealerpoints < Loser then screen:blit(0,0,win) Money =+ Bet elseif Points == Winner and Dealerpoints < Winner then screen:blit(0,0,win) Money =+ Bet elseif Dealerpoints == 11 then screen:blit(0,0,lose) Money =- Bet elseif Dealerpoints == Winner and Points < Winner then screen:blit(0,0,lose) Money =- Bet elseif Dealerpoints > Points then screen:blit(0,0,lose) Money =- Bet end end
-
05-08-2006, 09:17 PM #2171words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Umm... your grammar i cannot understand very well, but you an always use a bool:
This will steadilydecrease your Money integer by 1 every second as long as the Dealer has more points then you. Hope this helps.Code:yourBOOLnameHERE = false while true do if Dealerpoints > Points then screen:blit(0,0,lose) Money =- Bet yourBOOLnameHERE=true end if yourBOOLnameHERE==true then Money-=1 screen.waitVblankStart(60) end
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
05-09-2006, 03:48 AM #2172<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
how would you read the second(or 3rd or 4th or whatever) line in another txt file
i want each line to be a seperate table
ie
line 1 -> t = {}
line 2 -> z = {}
line 3 -> g = {}
and so on
-
05-09-2006, 04:32 AM #2173QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Do this, because everytime you read the same file, it reads the next line down.. i think.
Zitat von Sousanator
I dont know if this works.. as i havent tested it yet.
Ill edit this with more on how to do this and more ways after i get back from school.Code:file = io.open("yourfile.txt", "r") linea = file:read() lineb = file:read() linec = file:read() file:close() line = {} line[1] = {"linea"} line[2] = {"lineb"} line[3] = {"linec"}
-
05-09-2006, 06:25 AM #2174QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I got the "Loop in Gettable" error working, but i still need serious help with how the use the "return" command.
I would like to have it like "elseif return false" so it will skipp to load the image or any other file.
Please help me out, this is the last piece to complete my work![CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-09-2006, 08:22 AM #2175is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
montrob, I think that will just read the top line again every time, however, i'm not certain, I will also need to know this for LuaMainframe, I suppose it will be the shell with no cursor lol!
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
05-09-2006, 10:15 AM #2176
@Sousanator, Montrob and everybody.
this is from http://www.lua.org/manual/5.0/manual.htmlio.lines ([filename])
Opens the given file name in read mode and returns an iterator function that, each time it is called, returns a new line from the file. Therefore, the construction
for line in io.lines(filename) do ... end
will iterate over all lines of the file. When the iterator function detects the end of file, it returns nil (to finish the loop) and automatically closes the file.
The call io.lines() (without a file name) is equivalent to io.input():lines(), that is, it iterates over the lines of the default input file.
Damn i cant believe how often i have given this link and that of http://wiki.ps2dev.org/psp:lua_player
Maybe ill just put them in my sig
Geändert von Altair (05-09-2006 um 10:20 AM Uhr)
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-09-2006, 12:56 PM #2177Developer

- Registriert seit
- Mar 2006
- Ort
- Guadalajara
- Beiträge
- 958
- Points
- 7.499
- Level
- 57
- Downloads
- 0
- Uploads
- 0
Hey Guys How Can I Use The Irda Features In The Lua??

Current projects:
- pspshootoutsv0.4
- PSPIRATESv6 :D
- Kindom Hearths: Sora´s Adventure V0.2
- PSPirates Alarm Clock v0.3
- Changos!: fall of the army-ITS ALIVE AND WORKING (coming soon)
PSPMEX DevTeam.
-
05-09-2006, 04:32 PM #2178<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
so io.lines reads all the lines right??
Zitat von Altair
but i still dont understand how to do get each line as a new varible
-
05-09-2006, 05:00 PM #2179QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Ok i need help on tilesets.. For my game AlphaAttack.. I am going to need buildings. I am trying to blit buildings with just one tile.. but going over and over again to form a pretty big structure. Is there anyway i can do this besides just blitting the same image with a diff. X and Y value everytime.
-
05-09-2006, 08:34 PM #2180QJ Gamer Green
- Registriert seit
- Apr 2006
- Beiträge
- 0
- Points
- 13.013
- Level
- 74
- Downloads
- 0
- Uploads
- 0
I might sound like a n00b saying this, but how do you write lua code???
-
05-09-2006, 10:22 PM #2181Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Look at past examples of programs, go to the tutorials which psp millionaire wrote. Evil mana i think they're called.
You write it in a text program like notepad, or you can use other programs which give you a bit more help like notepad++ .
That should get you started.
-
05-10-2006, 03:51 AM #2182
No. If you read it better, it says that everytime you use io.lines it reads the next line. Thats why they use a for loop in the example to read all the lines one at a time. That s exactly what you want.
Zitat von Sousanator
So you could do this:
Code:n=1 for lines in io.lines(filename) do line[n]=lines n=n+1 end
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-10-2006, 09:04 AM #2183QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
Is there a Lua-specialized-notepad app? Like the TTLDE in Lua OS?
Edit - I found one, - http://www.luaedit.net/ -, but I'm still looking for one that looks/works more like TTLDE.Geändert von EminentJonFrost (05-10-2006 um 09:17 AM Uhr)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-10-2006, 09:26 AM #2184
I use ConTEXT its also free. You can download all sorts of context highlighters also LUA.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-10-2006, 09:29 AM #2185QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
hi, can anyone tell me the commands for the following;
to pause the game
to exit the game to luaplayer (on the psp)
Pm me the anwser or reply here thanks<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
05-10-2006, 11:55 AM #2186QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
to pause, pretty simple actually. its just a function.
Zitat von JoeDaStudd
Example:
To quit back to luaplayer you just make a variable that will be your 'control' of whether or not the game will be 'on'.Code:function pause() white = Color.new(255, 255, 255) while true do screen:clear() pad = Controls.read() screen:print(x, y, "Press Start to continue", white) if pad:start() then break end screen.flip() screen.waitVblankStart() end end
Example:
To Altair: Thanks!Code:quit = false [functions] [game] --in all your functions and in the main loop, you put: if quit == true then break end
Geändert von EminentJonFrost (05-10-2006 um 11:59 AM Uhr)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-10-2006, 12:20 PM #2187
- Registriert seit
- May 2006
- Beiträge
- 41
- Points
- 4.063
- Level
- 40
- Downloads
- 0
- Uploads
- 0
2 days ago, I had no idea what you were talking about...
now, i understand it all :)
-
05-10-2006, 12:26 PM #2188QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you mean me?
Zitat von Tritoch
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-10-2006, 01:07 PM #2189QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
thanks
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
05-10-2006, 01:49 PM #2190
- Registriert seit
- May 2006
- Beiträge
- 41
- Points
- 4.063
- Level
- 40
- Downloads
- 0
- Uploads
- 0
i meant all lua coders... :icon_razz
Zitat von EminentJonFrost


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum