Home ← TI-Nspire Authoring ← Lua Scripting HQ ← Lua and JavaScript
Lua and JavaScriptTry your own...
Enter your script into the text box below, and then click the button. |
You might start by copying and pasting these simple scripts into the lower text box and then click "run your code!"Example 1: Text function on.paint(gc)local screen = platform.window local w = screen:width() local h = screen:height() local str = "This is my text" local sw = gc:getStringWidth(str) gc:setColorRGB(50, 50, 250) gc:drawString(str, (w - sw)/2, h/2, "middle")end Example 2: Graphics function on.paint(gc)local screen = platform.window local w = screen:width() local h = screen:height() local width = w/3 local height = h/3 gc:setColorRGB(50, 50, 250) gc:fillRect(w/2 - width/2, h/2 - height/2, width, height) gc:setColorRGB(250, 50, 50) gc:fillArc(w/2 - width/2, h/2 - height/2, width, height, 0, 360)end |