Problem with Print()
Moderators: Shine, Insert_witty_name
Problem with Print()
print("string") does not work anymore?! any reasons why?
Im using v0.20 I noticed it does not work in 0.18+
Im using v0.20 I noticed it does not work in 0.18+
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
Retired Engineer
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. :)
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
Retired Engineer
- daurnimator
- Posts: 38
- Joined: Sun Dec 11, 2005 8:36 pm
- Location: melbourne, australia
print() is the function i am talking about for such matters. Instead of,get a serial cable to debug... - or just print to the screen...
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
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