![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on lua programming help please within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ok im a total n00b at lua but ive started to look at some of the tutorials and so far ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
ok im a total n00b at lua but ive started to look at some of the tutorials and so far i have written this but whenever i play it it comes on and then stop almost instantly.
-- My First Lua Program -- Author: Mark.Sparky blue = Color.new(0, 0, 255) screen rint(200, 100, "Yeah! I finally made a lua program", red)screen.flip() screen.waitVblankStart() end i was wonderin what im doin wrong to make it not work properly right now. Also it says when i run it in smd.exe there is an error: script.lua:8: <eof> expected near 'end' oh and im sorry about the previous post about that rpg game. Last edited by mark.sparky; 04-07-2006 at 12:59 PM.. |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
From here on out, I HIGHLY suggest (thought dont demand), that you post your LUA specific questions in the LUA coding help thread, you'll get a response fast, as its a busy thread. Also try to go through it, because I can promise you most of your questions have been asked (and answered, including this one). Even though I dont know LUA, as I dont use it, your problem is that you have no loop structure running in your code. Basically you need a while loop that stays running outside of your main code to keep your code re-iterating. This is typically done with some style of the while statment. In lua, I beleive it is done like so:
while true do (insert all your main code here) end so your code should be this: while true do blue = Color.new(0, 0, 255) screenrint(200, 100, "Yeah! I finally made a lua program", red) screen.flip() screen.waitVblankStart() end (if anyone who actually knows lua cares to correct me, i suggest it) |
|
|
|
#4 |
![]() ![]() total-Z
|
I agree, I hate how everyone keeps making new threads for a lua question that belongs in the lua thread.
And here's my correction: blue = Color.new(0, 0, 255) while not Controls.read():start() do screen:print(200, 100, "Yeah! I finally made a lua program", blue) screen.waitVblankStart() screen.flip() end Now it exits on start and has blue defined. I think the way you had it (with red) would have instantly crashed it.
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
Does your code work now?
|
|
|
|
#7 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#8 |
|
Guest
Posts: n/a
|
^ read my post right after his yoursame
|
|
|
|
#10 |
![]() ![]() Bush Programmer
|
You should aim to make it ask for your name,
and if the name you give it is wrong, the program exits, if it's right, the program says hello to you. That's conditional branching. Since the PSP has no keyboard, your name might have to be a single button to start with. |
|
|
|
![]() |
| Tags |
| lua , programming |
| Thread Tools | |
|
|