QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

lua programming help please

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 ...

Reply
 
LinkBack Thread Tools
Old 04-07-2006, 12:51 PM   #1
 

 
Join Date: Oct 2005
Location: Scotland, UK
Posts: 571
Trader Feedback: 0
Default lua programming help please

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)
screenrint(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..
mark.sparky is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:00 PM   #2
Aerol33t
Guest
 
Posts: n/a
Default

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)
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:05 PM   #3
 

 
Join Date: Oct 2005
Location: Scotland, UK
Posts: 571
Trader Feedback: 0
Default

ok sorry again i didint even know up unitl now there was a lua help thread
mark.sparky is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:06 PM   #4

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

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
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:07 PM   #5
Aerol33t
Guest
 
Posts: n/a
Default

Does your code work now?
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:08 PM   #6
 

 
Join Date: Oct 2005
Location: Scotland, UK
Posts: 571
Trader Feedback: 0
Default

yeah it works thnx
mark.sparky is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:09 PM   #7

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

Quote:
Originally Posted by Aerol33t
Does your code work now?
His problem was that he was displaying his...code stuff... and made it flip the screen once then exit. He needed to make it either keep flipping or pause until the program exits.
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 01:22 PM   #8
Aerol33t
Guest
 
Posts: n/a
Default

^ read my post right after his yoursame
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 02:17 PM   #9

Gutya
 

 
Join Date: Feb 2006
Posts: 2,398
Trader Feedback: 0
Default

And you can't use red if it isnt a color.
__________________
D:
Gutya is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2006, 07:43 PM   #10
Art

Bush Programmer
 
Art's Avatar
 
Join Date: Nov 2005
Posts: 3,557
Trader Feedback: 0
Default

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.
Art is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
lua , programming

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 12:35 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us