![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on I need a help ! (LUA code sample) within the Developer's Dungeon forums, part of the PSP Development Forum category; Hi everyone ! (So first..my english is soo weak so i try to do my best ! ) I really ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
My Mood:
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
|
Hi everyone ! (So first..my english is soo weak so i try to do my best !
![]() )I really need your help,guys... I need a piece of LUA code.... 1.Initalize WiFi connection Then 2.Connect via socket to my domain at port 80 3.Download a file (001.jpg) 4.Show 001.jpg on PSP screen When i press a right.. The PSP going to delete 001.jpg from RAM and download 002.jpg and show it! When i press a right.. The PSP going to delete 002.jpg from RAM and download 003.jpg and show it! When i press left... The PSP going to delete 003.jpg from RAm and download 002.jpg again and show it ! ++You know what i mean,kind like online picture viewer...I need to run it on Lua Player HM++ I really need this piece of code guys So please,if you help me a bit and post/send me a sample code,...I like to learn it but i spent on it 8days but nothing,im realy frustrated so please help me ![]() Thanks again... I hope somebody help
|
|
|
|
|
|
#2 |
![]() ![]() |
could someone move this to the lua help thread ?
and btw, you could also try posting your piece of code first, then I'm sure someone would take a look at it and tell you what you're doing wrong also, I remember posting a download function for lua here somewhere, just search for it ![]() EDIT: here's the download function
Last edited by mootjeuh; 10-31-2009 at 07:26 AM.. |
|
|
|
|
|
#3 |
![]() ![]() Developer
|
I'm not usually the one to hand out code, but I was bored.
For PGE Lua: Code:
SERVER = "example.com"
MAX = 10
downloadedImages = {} --Why delete downloaded images?
function downloadAndDisplay(imageNumber)
local filename = string.format("%03d.jpg", imageNumber)
if not downloadedImages[imageNumber] then
local url = string.format("http://%s/%s", SERVER, filename)
pge.net.getfile(url, filename)
downloadedImages[imageNumber] = true
end
local texture = pge.texture.load(filename)
pge.gfx.startdrawing()
pge.texture.draweasy(texture, 0, 0)
pge.gfx.enddrawing()
pge.gfx.swapbuffers()
--texture /should/ be freed by the garbage collector, it might not be.
end
function main()
local currentImageNumber = 1
assert(pge.net.init())
while true do
pge.controls.update()
local load = false
if pge.controls.pressed(PGE_CTRL_LEFT) then
currentImageNumber = currentImageNumber - 1
load = true
elseif pge.controls.pressed(PGE_CTRL_RIGHT) then
currentImageNumber = currentImageNumber + 1
load = true
end
if load then
if currentImageNumber < 1 then
currentImageNumber = 1
elseif currentImageNumber > MAX then
currentImageNumber = MAX
end
downloadAndDisplay(currentImageNumber)
collectgarbage()
end
end
end
main()
|
|
|
|
|
|
#4 |
|
My Mood:
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
|
Oh thank you soo much guys!
You really help me a lot.... Im sorry for bad thread section ![]() mootjeuh:Thanks for this exaple,using your sample code i found a BIG mistake in my code,so now i can fix it,BIG thanks Nielkie: Thanks,i recently try some things in PGE-LUA and your example help me a lot,so big thanks for you,too
|
|
|
|
|
|
#5 |
|
My Mood:
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
|
Me again...
First sorry for Double post...But i have a problem again ![]() Nielkie: Your script freezes my PSP,everytime i loaded it...can you pls look at it and tell me what im doing wrong ? i found your script very useful and i want to use it but i cant...I know shi* about PGELua,so if you cant check it and send me a ZIP archive with right player and code Thank you.....I know you dont help n00bs with code but i would be gratefulOr somebody,pls can you send me a premade LUA or pgeLUA tutorial for download a image from internet using Wi-Fi : http://nil3e.net/ondra/dlf/back.JPG and show it on the PSP screen ? if you help im gonna send you some of my points,i really need this sample for my next project ..and again i stuck on it... ://// I would be most grateful Thanks
|
|
|
|
|
|
#6 |
![]() ![]() Developer
|
Does pge.net.getfile block?
__________________
[Blog] [Portfolio] [Homebrew Illuminati - Serious Homebrew Development Forums] [I want to make Homebrew FAQ] [How I broke into the Games Industry] [Programming Book List] [Programming Article List] |
|
|
|
![]() |
| Tags |
| code , lua , sample |
| Thread Tools | |
|
|