This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jay5476's profile picture

New API!

Started by jay5476, 15 August 2012 - 08:03 AM
jay5476 #1
Posted 15 August 2012 - 10:03 AM
Okays So I Got Bored! But Best Things Come From Boredom :P/>/> Well Onto The Point Last Night I Created An Api That I Thought Would Help Me Alot While Using Computercraft For Monitors And Computers I Will Rate The Usefulness Out Of 5 (With 5 Being Pretty Darn Useful)
So Here Is The Functions

clearScreen()
SpoilerDescription: Clear The Entire Screen
How To Use: Type <api name>.clearScreen()
Rating: 3 Stars

cPrint(text)
SpoilerDescription: Print The Text In The Center Of The Screen
How To Use: type <api name>.cPrint("<Text Wanted>")
Rating: 5 Stars

printBorder()
SpoilerDescription: Prints A Border Around The Screen
How To Use: Type <api name>.printBorder()
Rating: 2 Stars
Note: Always Set Cursor Position Back To Two And Wont Work Unless In A Loop

clearLineTo(line)
SpoilerDescription: Clear To A Certain Line
How To Use: Type <api name>.clearLineTo(line)
Rating: 5 Stars

redOpen()
SpoilerDescription: Opens All Rednet Modems
How To Use: Type <api name>.redOpen()
Rating: 4 stars

monPrint(text, side, size)
SpoilerDescription: Writes Text On Determined Side
How To Use: Type <apiname>.monPrint(text, side, size)
Rating: 4 stars
Note: The Size Doesnt Need A "" Just a 1,2,3,4 or 5
Note: Also Goes To Next Line


monClear(side)
SpoilerDescription: Clears The Monitor On Determined Side
How To Use: Type <api name>.monClear(side)
Rating: 4 stars

If Your Your Wondering What The Heck Is The <> For Well It Stands For User Defined Becuase It Is Up To You Really In The Example <api name> You Choose The Name Of The API
Please Give Your Ideas, Honest Opinion, Bugs And Your Personal Ratings Of The Functions

link: www.pastebin.com/LCq5AsUS– You Didnt Really Think I Would Forget
Also Check Back Becuase I Will Be Constenly Updating Functions See Ya :D/>/>!

INSTALLING: MAKE A FILE IN THE API'S DIRECTORY AS THE NAME U WISH TO USE AND USE A TEXT EDITOR I USE NOTEPAD++ CODE THEN REBOOT ALL COMPUTERS IN YOUR WORLD GO INTO
LUA AND TYPE <API NAME>.TEST()
Cranium #2
Posted 15 August 2012 - 03:22 PM
I like the code, but I don't like your post. Not every word requires capitalization.
ciba43 #3
Posted 15 August 2012 - 09:47 PM
Some might like it, Some not.
Cranium #4
Posted 15 August 2012 - 10:01 PM
Some might like it, Some not.
Eh, just my preference. Not speaking for anyone but myself.
Noodle #5
Posted 15 August 2012 - 10:25 PM
You could add these functions to terminal API.
Mmmmmmmm #6
Posted 16 August 2012 - 05:05 AM
Some might like it, Some not.
Well, it's not exactly a preference, it's just basic grammar. Capitalisation of every word is annoying to read (I suppose this is subjective), annoying to type and grammatically wrong. Just confusing.

Other than the post, though, the code's pretty neat for your first project (at least, I think it is). In some places, though, the code could use some improvement. For example, remember to use local whenever possible.
jay5476 #7
Posted 16 August 2012 - 06:22 AM
Okay going to change post around.

So thanks for feedback first thing I will get back about is the bit about using local
I don't really know what it will do for me but I'll change it :(/>/>

Next the bit about mentioning the terminal API
Well the name I call it is extTerm so I would recommend add it to the API if u can
ardera #8
Posted 16 August 2012 - 09:22 AM
You could add these functions to terminal API.

If you mean the term API, the _G table is protected and if the local var bProtected in the bios.lua is set to true, then you can't add functions or new Indexes to it.
See MetaMethods