Here's my full .lua:
It's not working as intended btw. So I'm doing some experiments.
How can I be sure I'm purging everything? If I don't know that maybe I'm not purging anything.
Anyway, I'm using the provided demos and documentation to help me.
Code:
while true do
-- updating screens
Screen.waitVblankStart()
Screen.refresh()
Screen.flip()
-- Variable initializing
if (init == nil) then
fontsize = 16
mchr = 45
curline = 0
mlines = 13
marginx = 10
marginy = 10
posline = marginy
init = true
end
-- Font definitions
defaultfont = Font.load("monof55.ttf") -- use mono-spaced fixed width fonts
textcolor = Color.new(255,255,255)
Font.setPixelSizes(defaultfont,fontsize)
-- Wait for buttons
if (Controls.check(Controls.read(),KEY_HOME)) then System.exit() end
if (Controls.check(Controls.read(),KEY_A)) then newline("testing") end
-- Functions
-- Text processing
function newline (text)
strsize = string.len(text)
if (strsize >= mchr) then
fullline = string.sub(text,0,42)
splitchr = fullline:find"%s$" or fullline:find"%s%S-$" or mchr
newtext = string.sub(text,0,splitchr)
addline(newtext)
nexttext = string.sub(text,splitchr+1)
newline(nexttext)
else
addline (text)
end
end
function addline(val)
--if (curline > mlines) then clear() end
curline = curline+1
Font.print(defaultfont, marginx, posline, val, textcolor, BOTTOM_SCREEN)
posline = posline + fontsize
end
end
It's not working as intended btw. So I'm doing some experiments.
How can I be sure I'm purging everything? If I don't know that maybe I'm not purging anything.
Anyway, I'm using the provided demos and documentation to help me.