FunctionPlotter.lua

From codeTank

Jump to: navigation, search
Function Plotter Screen Shot
Function Plotter Screen Shot

FunctionPlotter.lua is a simple little script that demonstrates how to create an application using Brain Damage. It will plot a given function in the window.

Download it here: http://codetank.com/pub/sean/FunctionPlotter.lua

(Latest Update to Source Code: 15 Jan 2008)

How to Use

Enter your function in the box, then click on Plot.

Homework

Allow the user to graph multiple functions, each in a different color.

The viewing window is stuck at (-6, -2) - (6, 2), which is held inside the minx, miny, maxx, maxy variables. Make a way for the user to alter these values, so they can specify their own viewing window.

The function that creates the graph is a little insecure... for example, try graphing (Shift+F7 will interrupt the graph): window.create().x. Perhaps using setfenv can help fix this bizarre bug.

Personal tools