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; Could someone point me to a tutorial that will let me compile my Lua Games? I don't know if this ...
-
04-03-2007, 04:43 PM #6511
Could someone point me to a tutorial that will let me compile my Lua Games?
I don't know if this will work or not but currently my game uses all the free memory without everything being loaded....I was hoping maybe pre-compiling my game as standalone would give me more available space...
-
04-03-2007, 05:15 PM #6512QJ Gamer Gold
- Registriert seit
- Nov 2006
- Ort
- ...
- Beiträge
- 2.080
- Points
- 11.942
- Level
- 71
- Downloads
- 0
- Uploads
- 0
there was one in the lua help thread section on evilmana
-
04-03-2007, 05:37 PM #6513Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
It won't.
Zitat von ClearTranquil
Try only loading the things you need immediately, and then setting them to nil when you are done with them for a while.
-
04-03-2007, 06:36 PM #6514
Zitat von Merick
wow there is help on this forum im hapy here :Cry: graciasss
Zitat von youresam
-
04-04-2007, 10:07 AM #6515QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
my code:
problem is bolded inside the code... it doesnt work, it doesnt do nothing, any help?Code:-- farby white = Color.new(255,255,255) blue = Color.new(0,128,255) seda = Color.new(175,175,175) bg = Image.load("pic.png") -- premenne menu = 1 polozka = 0 while polozka == 0 do pad = Controls.read() screen:clear() screen:blit(0,0,bg) screen:print(10,10, "Polozka 1", white) screen:print(10,20, "Polozka 2", white) screen:print(10,30, "Polozka 3", white) if menu == 1 then screen:print(10,10, "Polozka 1", blue) elseif menu == 2 then screen:print(10,20, "Polozka 2", blue) elseif menu == 3 then screen:print(10,30, "Polozka 3", blue) end if menu == 4 then menu = 1 end if menu == 0 then menu = 3 end if pad:down() and oldpad:down() ~= pad:down() then menu = menu + 1 elseif pad:up() and oldpad:up() ~= pad:up() then menu = menu - 1 end if menu == 1 and pad:cross() then polozka = 1 end while polozka == 1 do screen:clear() screen:print(10,10, "veci k polozke 1", white) if pad:circle() then polozka = 0 end screen.waitVblankStart() screen.flip() end screen.waitVblankStart() screen.flip() oldpad = pad end[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-04-2007, 10:12 AM #6516Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
when you enter the second loop, you are no longer reading the pad variable, so make sure to put
in the second loopCode:pad = Controls.read()
-
04-04-2007, 10:19 AM #6517QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
oh yeah, thx ;)
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-04-2007, 01:02 PM #6518
hey, its me again and im still as noobish as before ^^
ive read many great tuts on the net , but i dont understand how u can use the analog nub (nob?? ^^), does any1 have a good tutorial on that one?
-
04-04-2007, 01:21 PM #6519
Controls:analogX() and Controls:analogY() jeez.
Zitat von nUke_moose
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-04-2007, 01:29 PM #6520
sry for asking.....but this still doesnt help me that much, maybe ill explain what i want to do: basically, the first thing every beginner makes, after completing the tutorials, is a 2d sidescrolling game with simple animation. i know how to use all the other buttons, but the analog somehow wont work
so please be a little more detailed or just give me link, cuz im new to the szene and dont really know alot of good websites....
-
04-04-2007, 01:41 PM #6521
I made a DDR clone. Without tuturials (as there were none at the time)
Zitat von nUke_moose
Anyway, stop asking for tutorials. Tutorials = making you a lua n00b. Learn yourself. You understand it better.
Controls:analogX() and Controls:analogY() returns a number between -127 and 128, note that they are OO, so you should pass a Controls object to it. (Im sure youve learned pad or whatever)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-04-2007, 01:44 PM #6522QJ Gamer Gold
- Registriert seit
- Nov 2006
- Ort
- ...
- Beiträge
- 2.080
- Points
- 11.942
- Level
- 71
- Downloads
- 0
- Uploads
- 0
did ya try evilmana to see if they had stuff over analog? cause i checked and found it
-
04-04-2007, 01:45 PM #6523QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
sample script:
Zitat von nUke_moose
Code:red = Color.new(255,0,0) black = Color.new(0,0,0) white = Color.new(255,255,255) player = Image.createEmpty(32,32) player:clear(red) Player = { x = 100, y = 100, img = player } function analogMove() pad = Controls.read() anaX = pad:analogX() anaY = pad:analogY() if anaX > 50 then Player.x = Player.x + 5 end if anaX < -50 then Player.x = Player.x - 5 end if anaY > 50 then Player.y = Player.y + 5 end if anaY < -50 then Player.y = Player.y - 5 end end function walls() if Player.x > 448 or Player.x < 0 then Player.x = oldx end if Player.y < 0 or Player.y > 240 then Player.y = oldy end end while true do oldx = Player.x oldy = Player.y screen:clear() screen:blit(Player.x,Player.y,Player.img) analogMove() walls() screen:print(5,5,"analogX: " .. anaX, white) screen:print(5,15,"analogY: " .. anaY, white) if pad:cross() then break end screen.flip() screen.waitVblankStart() end[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-04-2007, 02:08 PM #6524
thx for the replies, i know i should have found out about it by myself, so ill remember it better, but im beeing cut off the internet for a week, starting tomorrow, and i thought id ask before i get stuck... well, thx again
-
04-04-2007, 02:36 PM #6525Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I always thought it was silly when the analog controls were used like digital ones in situations like that. By the way, I just searched this thread for "analog" and this was from one of the first results:
Notice that the more the analog stick is deflected, the larger the change in position.Code:pad = Controls.read(); if math.abs(pad:analogX()) > 20 then x = x + pad:analogX() / 64; end if math.abs(pad:analogY()) > 20 then y = y + pad:analogY() / 64; end screen:print(x,y-5,"<|",w); screen.waitVblankStart(); screen.flip()
-
04-04-2007, 08:39 PM #6526Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
^^
Zitat von LMelior
thats the correct usage of the analog stick. if you just want to move something by a constant, why not use the d-pad?--------------------------------------------------------------------------------------
-
04-05-2007, 12:05 AM #6527
hiii thereee its mee again,,, does any body know where to find Lua Player v0.20 Mod 3 binary files ??? i i can found is the source... and ive no idea of how to compile...
-
04-05-2007, 03:07 AM #6528QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Zitat von myschoo
whats that for? game?
-
04-05-2007, 05:24 AM #6529QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
it can be for anything
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-05-2007, 02:37 PM #6530
Is there a way to insert a tab into a string (except using a few spaces) because "\tHello" prints OHello.
TIA
-
04-05-2007, 02:48 PM #6531QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yea but first you have to stop listening to fallout boy. Lua detects if you are and makes everything not work.
-
04-05-2007, 02:55 PM #6532
There is no such set "tab". Lots of text editors insert 4 spaces for a tab, while notepad inserts 8. So just do a.. string.gsub(str,"\t", string.rep(" ",4))
Zitat von Fallout_Boy
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-05-2007, 04:13 PM #6533
hii there this is my foruth post i think, and see what i have four you guys, :P if you know 3dmax, or ascii 3d files (ASE) you you must try this tool i just made, its a tool to port 3dmax models to lua trought ASE format. all you have to do is to expot your max to ase then use my tool and you will have the triangle array to use in gu.
Download Ahrimanes ASE2LUA v0.1
it includes:
some ase models
1 max model to test 3dmx to ase then lua
ase2lua v0.1 by ahrimanes (me)
tutorial folder
and eboot folder(this is a test of the ship.max) basically luaplayer testhing ase2lua output.
well still left to port the u,v for maping, by now no textures suported, but you can start testing complexmodels on you programs. hope you like... stay tuned to futher releases.....
pleaaaseee leave your comentesss.
edit: haaaa almost forgot, this runs under windows and you must have installed ms excel.
-
04-05-2007, 04:25 PM #6534QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
How do I inject letters into a string? For example, if my string was "abdef", how would i make it say "abcdef"? Also, how do you read just part of a string, say, the first ten characters? And lastly, how do you find the number of characters in a string? Thanks for any help.
-
04-05-2007, 05:35 PM #6535QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Just a screen from the mandelbrot-like program i'm making.
[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]
-
04-05-2007, 05:36 PM #6536
str1 = str1 .. "t"
Zitat von romulator
= string.sub(str1,1,10)
= string.len(str1)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-05-2007, 11:19 PM #6537QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Hey, thanks for that youresam. That clears up a lot of confusion. Could you please just elaborate on the second argument of the second function? I like to understand things fully before I use them. Thanks again!
EDIT: The first function adds text to the end of a string but how will I be able to inject it into the middle of the string as in my example?
EDIT2: Adding "\n" to the end of a string doesn't print a new line, it only prints the letter O in a black box. Whats up with that?Geändert von romulator (04-05-2007 um 11:37 PM Uhr)
-
04-06-2007, 12:16 AM #6538
im not shure if there is not a function to insert text but if its the case you could do your own function whit those like:EDIT: The first function adds text to the end of a string but how will I be able to inject it into the middle of the string as in my example?
EDIT2: Adding "\n" to the end of a string doesn't print a new line, it only prints the letter O in a black box. Whats up with that?
dident test but i supose it should work. good luckCode:function inserts(str1,str2,pos) str3 = string.sub(str1,1,pos) str4 = str3 .. str2 .. string.sub(str1,pos,string.len(str1)) return str4 end -- to use it like str1 = "abdefg" str1 = inserts(str1,"c",2)
-
04-06-2007, 01:03 AM #6539QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Thanks for the function ahrimanes, a lot of help it was. I had to mod it a tiny bit though as it would insert the text but with the preceeding letter in front of it as well. For example, to insert "???" into "abc" at number 2, it would return "ab???bc". Here is the simple fix:
function InsertString(str1,str2,po s)
str3 = string.sub(str1,1,pos)
str4 = str3 .. str2 .. string.sub(str1,pos + 1,string.len(str1))
return str4
end
Thanks again. Do you know why the \n escape sequence does not enter a new line?
-
04-06-2007, 03:00 AM #6540
I think i do. The line break technically is in the string as i've seen it working when you save a string with a line break into a text file. I think that when you print the string it replaces the character with the one that you see.
Zitat von romulator


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