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/
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 »

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 »

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
Rinnegatamante
VIP
Posts: 912
Joined: Sat Mar 26, 2011 10:02 am
Contact:

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

Post by Rinnegatamante »

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

Oh my God, I'm soo stupid, it is located in "cache0:/lpp/splashscreen.jpg". x___x Thank you for the answer Rinnegatamante ! ^^
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 »

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

Code: Select all

a,b = Network.initFTP()
Thanks a lot!
please reply
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 »

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
qwikrazor87
Guru
Posts: 2874
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 »

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ō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
Rinnegatamante
VIP
Posts: 912
Joined: Sat Mar 26, 2011 10:02 am
Contact:

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

Post by Rinnegatamante »

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
qwikrazor87
Guru
Posts: 2874
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 »

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ō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
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 »

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
Locked

Return to “Revitalize Competition”