Problem with Print()

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Problem with Print()

Post by romero126 »

print("string") does not work anymore?! any reasons why?

Im using v0.20 I noticed it does not work in 0.18+
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I don't know where print() should print but have you tried io.write("string\n")?
Geo Massar
Retired Engineer
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

neither work
Altair
Posts: 76
Joined: Sat May 20, 2006 2:33 am
Location: The Netherlands

Post by Altair »

and you are using "screen:print()", right?
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

no just the command print() which used to work for debugging purposes.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Perhaps print() command writes somehting on the back buffer of the screen. If so, flip the screen to read the output. If no help, the screen should be turned off somehow in order to view the output on PSP. Of course, you can use Windows version to debug but the version is pretty old.
Geo Massar
Retired Engineer
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

I cant use an old version to debug im useing 5.1 syntax for some file manipulation. And if memory serves me file manipulation has a big problem in the windows client.

Also screen.flip() does not allow me to show an output either. I did a work arround but its a nasty hack I would rather not use.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Sorry, dude. I tried to help.

Perhaps, you could implement Windows version for Lua 5.1 with some additional features as needed in order to debug your thingy. You could get the source at lua.org. I know it is a nasty job to do.

I do mine for Windows version but it is not for PSP. It is all written in Pascal rather than ANSI C.

PS If you do the Windows version, share it with other PSP coders. You'll get a metal with a flying color. :)
Geo Massar
Retired Engineer
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

print() hasnt worked since the release of .18alpha
User avatar
daurnimator
Posts: 38
Joined: Sun Dec 11, 2005 8:36 pm
Location: melbourne, australia

Post by daurnimator »

and i think it shouldn't....

get a serial cable to debug... - or just print to the screen...
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

get a serial cable to debug... - or just print to the screen...
print() is the function i am talking about for such matters. Instead of,

screen:print(0, 0, "text", color.new(0,0,0))
screen.waitVblankStart()
screen.flip()

For each variable output is perposterous just for the sake of a 30 second debug. Print("variable :".. var)

now immagine doing that for multiple variables. Thats just a waste of debugging time a person just wasted on getting data.

Print needs to work, I was posting that it doesnt work so that Shine the creator of the LUA player can fix that.

When i type print("text") it hints to its sucess but fails in display. That obviously needs to be fixed. Since it is not working as inteded.

Now if it was removed then you would get the error
Error: PATH/file.lua:(line): attempt to call global 'print' (a nil value)

Press start to restart
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

Furthermore here is a workarround for developers to use. (It works just like in dos)

Code: Select all


IO_LIB = {
	x = 0,
	buffer = Image.createEmpty(480, 272),
	prebuffer = Image.createEmpty(480, 272)
}
function IO_LIB:PrintF(text)
	for i = 1, string.len(text) do
		char = string.sub(text, i, i)
		if char == "\n" then
			self.prebuffer:clear(Color.new(0, 0, 0))
			self.prebuffer:blit(0, -10, self.buffer, true)
			self.buffer:blit(0, 0, self.prebuffer, 0, 0, 480, 272, true)
			self.x = 0
		elseif char ~= "\r" then
			self.buffer:print(self.x, 264, char, Color.new(255,255,255))
			self.x = self.x + 8
		end
	end
	screen:blit(0, 0, self.buffer)
	screen.waitVblankStart()
	screen.flip()
end


Post Reply