Advertising (This ad goes away for registered users. You can Login or Register)

Lua Player Plus VITA (lpp-vita) - Lua interpreter for PSVITA

Submit here your entries for the Revitalize Competition. Deadline is September 30th.
Rules can be found here: http://wololo.net/revitalize/
User avatar
MyLegGuy
Posts: 140
Joined: Sat May 16, 2015 10:40 pm
Location: United States

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by MyLegGuy » Mon Sep 21, 2015 1:22 am

Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()
Advertising
please reply

Ervilha
Posts: 4
Joined: Wed Sep 16, 2015 11:10 am

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by Ervilha » Mon Sep 21, 2015 12:37 pm

MyLegGuy wrote:Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()
Advertising

User avatar
Rinnegatamante
VIP
Posts: 758
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by Rinnegatamante » Mon Sep 21, 2015 6:02 pm

Ervilha wrote:
MyLegGuy wrote:Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()
Agree, for now socketing is unstable.
Virus wrote:My image is correctly located in "cache0:/splashscreen.jpg", not in the root... :/
When you connect your VITA with ftpVITA, cache0:/ folder is the root.
If you want, visit my website: http://rinnegatamante.it :D

User avatar
Virus
Posts: 26
Joined: Sun May 06, 2012 12:46 pm
Location: In The Matrix
Contact:

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by Virus » Mon Sep 21, 2015 6:07 pm

Oh my God, I'm soo stupid, it is located in "cache0:/lpp/splashscreen.jpg". x___x Thank you for the answer Rinnegatamante ! ^^

User avatar
MyLegGuy
Posts: 140
Joined: Sat May 16, 2015 10:40 pm
Location: United States

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by MyLegGuy » Mon Sep 21, 2015 8:03 pm

Ervilha wrote:
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()
Thanks a lot!
please reply

User avatar
MyLegGuy
Posts: 140
Joined: Sat May 16, 2015 10:40 pm
Location: United States

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by MyLegGuy » Mon Sep 21, 2015 10:32 pm

What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
please reply

User avatar
qwikrazor87
Guru
Posts: 2868
Joined: Sat Apr 21, 2012 1:23 pm
Location: The North Pole

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by qwikrazor87 » Mon Sep 21, 2015 11:47 pm

MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Maxwest Nitro 4 phone - Android 5.1
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS

User avatar
Rinnegatamante
VIP
Posts: 758
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by Rinnegatamante » Tue Sep 22, 2015 1:22 pm

qwikrazor87 wrote:
MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.
lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).
If you want, visit my website: http://rinnegatamante.it :D

User avatar
qwikrazor87
Guru
Posts: 2868
Joined: Sat Apr 21, 2012 1:23 pm
Location: The North Pole

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by qwikrazor87 » Tue Sep 22, 2015 1:46 pm

Rinnegatamante wrote:lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).
Ok, my bad, I haven't tested this out (and can't).
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Maxwest Nitro 4 phone - Android 5.1
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS

User avatar
MyLegGuy
Posts: 140
Joined: Sat May 16, 2015 10:40 pm
Location: United States

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Post by MyLegGuy » Tue Sep 22, 2015 10:27 pm

Subject: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PSVITA
Rinnegatamante wrote:
qwikrazor87 wrote:
MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.
lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).
Alright, it seems that if the file ALREADY exists, and FWRITE or FRDWR is used, it'll work.

I can't use table.maxn, right?

I have another question.
When I use

Code: Select all

sometable={}
sometable = System.listDirectory("cache0:/somefolder")
the table gets a whole ton of other table values. How do I get the name of the file from the table?

Also, sorry I sent this as a pm to you. The quote button and the pm button look the same.
please reply

Post Reply

Return to “Revitalize Competition”