0 Members and 2 Guests are viewing this topic.
enterHasBeenPressed = false --initializes enterHasBeenPressed to be falsefunction on.paint(gc) if enterHasBeenPressed then --execute the following code if enterHasBeenPressed is true gc:drawString("Hello World", 0, 0, "top") endendfunction on.enterKey() enterHasBeenPressed = not enterHasBeenPressed -- will become true if false and false if true (switch state) platform.window:invalidate() --invalidates the window (basically, on.paint will be called)end
Code: [Select]math.eval(math_expression)This function sends an expression or command to the Nspire math server for evaluation. The input expression must be a string that the Nspire math server can interpret and evaluate.If the math server successfully evaluates the expression, it returns the numerical results. The eval function returns no result if the math server does not return a calculated result or if the calculated result cannot be represented as a fundamental Lua data type.If the math server cannot evaluate the expression because of a syntax, simplification, or semantic error, eval returns two results: nil and an error number.
math.eval(math_expression)
function on.paint(gc) gc:setColorRGB(0, 0, 0) draw = false for column=1, 8 do draw = not draw for row=1, 8 do draw = not draw if draw then gc:fillRect(column * 25 - 19, row * 25 - 19, 25, 25) end end end gc:drawRect(5, 5, 201, 201)end