Code Monkey home page Code Monkey logo

back2basic's Introduction

1. What it is
Back2BASIC is a library that allows you to have all the functions you loved in BASIC. This will help BASIC programmers switch to lua, as well as making it more straightforward to port BASIC programs to lua.

2. Already implemented
- b2b.menu (a prefabricated menu function)
- b2b.printText (like "HELLO" in BASIC, but with LESS-style page breaks)
- b2b.locate (like locate in BASIC)
- b2b.ygraph (Y= graph) 
- b2b.inputString (get user input)

3. To be implemented

4. Usage
Make a folder called "lib" in your root directory. Put b2b.lua in this folder.
In the program you wish to use the library, put run([[lib\b2b.lua]]) at the top.

5. Function syntax
NOTE: all width, height, x, and y values are not pixels, but characters.

b2b.autoFastCopy(option)
Set whether b2b commands should auto refresh the screen on completion.
- option: 1 or 0. 1 means it will automatically refresh the display, 0 means its will not.

b2b.menu(x, y, width, height, title, array, colorfg (optional), colorbg (optional))
a menu function. returns number of selected item.
- x: integer
- y: integer
- width: integer
- height: integer. if smaller than number of items, menu will automatically scroll.
- title: string. title to be displayed above menu.
- array: array. menu options. ex. {"entry1", "entry2"}
- colorfg, colorbg: color. defaults to b&w

b2b.printText(string, colorfg (optional), colorbg (optional))
displays text with LESS-style page breaks
- string: string to be printed
- colorfg, colorbg: color. defaults to b&w

b2b.locate(x, y, string, colorfg (optional), colorbg (optional))
like the Locate command in BASIC.
- x: integer
- y: integer
- string: string to be displayed
- colorfg, colorbg: color. defaults to b&w

b2b.ygraph(f, vwin (optional), type (optional), colorfg (optional), colorbg (optional))
Graphs a Y= graph.
- f: function of x to display. ex. function (x) return math.sin(x) end
- vwin: array. ex. {xmin=-6, xmax=6, ymin=-3, ymax=3, step=.1}
- colorfg, colorbg: color. defaults to b&w

b2b.inputString(prompt, colorfg (optional), colorbg (optional), blinkspeed (optional))
Returns user input.
- prompt: string. Is displayed above the input block.
- colorfg, colorbg: color. defaults to b&w
- blinkspeed: integer. speed cursor should blink at. defaults to 60.

b2b.fline(x1, y1, x2, y2, color (optional))
- x1 y1 x2 y2: integer. measurement in pixels.
- color: color. defaults to b&w

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.