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

BrineUtil

Started by KidBrine, 04 December 2017 - 11:36 PM
KidBrine #1
Posted 05 December 2017 - 12:36 AM
BrineUtil 5.5
This is where I will post my APIs which will all be a part of BrineUtil.


The APIs in BrineUtil currently are:
  • BrineMath 4.2
  • BrineText 4.0
  • BrinePic 1.0
  • BrineFormat 2.6
  • BrinePeripheral 1.0
BrineUtil Functions
[indent=1]Note: These are loaded when you run LoadAPIS.[/indent]
[indent=1]BrineUtil.Update()[/indent]
[indent=2]Update to the latest version of BrineUtil.[/indent]
[indent=1]BrineUtil.Uninstall()[/indent]
[indent=2]Uninstall BrineUtil. (Please don't go!)[/indent]
[indent=1]BrineUtil.VersionCheck()[/indent]
[indent=2]Lists the versions of all the APIS and BrineUtil that you have installed.[/indent]

BrineMath Functions
[indent=1]BrineMath.Average(T)[/indent]
[indent=2]T is many arguments no longer in the form of a table. (Thank You! Luca_S)[/indent]
[indent=2]Ex: BrineMath.Average(5,7,6,8,9,10)[/indent]
[indent=2]Returns NOT 38.3333333 but rather 7.5 ( Thank you Stekeblad for fixing probably the dumbest typo! )[/indent]
[indent=1]BrineMath.CircArea( R )[/indent]
[indent=2]R represents radius[/indent]
[indent=2]Ex: BrineMath.CircArea(3)[/indent]
[indent=2]Returns 28.274334[/indent]
[indent=1]BrineMath.Root(R, N)[/indent]
[indent=2]R represents the root you're looking for (Square = 2, Cubic = 3, 4th root, 5th root…)[/indent]
[indent=2]N represents the number you are finding the root of[/indent]
[indent=2]Ex: BrineMath.Root(7,128)[/indent]
[indent=2]returns the 7th root of 128 which is 2[/indent]
[indent=1]BrineMath.Circumference®[/indent]
[indent=2]R represents Radius[/indent]
[indent=2]Ex: BrineMath.Circumference(5)[/indent]
[indent=2]Returns 31.415926[/indent]
[indent=1]BrineMath.InjectMath()[/indent]
[indent=2]Inserts these functions directly into the math API (undone once shutdown)[/indent]
[indent=2]reversible using BrineMath.ExtractMath()[/indent]

BrineText Functions
[indent=1]BrineText.WritePos(T, X, Y)[/indent]
[indent=2]Writes T at X,Y on the terminal[/indent]

BrinePic Functions
[indent=1]BrinePic.Draw(I, X, Y)[/indent]
[indent=2]Draws the Image I at X, Y on the terminal[/indent]
[indent=1]BrinePic.CenterImage(I)[/indent]
[indent=2]Centers The Image I on the terminal[/indent]

BrineFormat Functions
[indent=1]BrineFormat.TextBin(C, S)[/indent]
[indent=2]S = a series of 1 character long strings Ex: C,"B","a","c","o","n"[/indent]
[indent=2]C = whether or not to concatinate (true/false) Ex: true,"B","a","c","o","n"[/indent]
[indent=2]Converts a set of characters to binary and returns them as either a table of strings or a single string.[/indent]
[indent=2]If the second argument is a table that will be used rather than the other arguments.[/indent]
[indent=1]BrineFormat.BinText(C, B )[/indent]
[indent=2]B = one or more sets of 8 digits either 1's or 0's that represent a binary character Ex: C,01000010,01100001,01100011,01101111,01101110[/indent]
[indent=2]C = whether or not to concatenate (true/false) Ex: true,01000010,01100001,01100011,01101111,01101110[/indent]
[indent=2]Convert one or more sets of 8 binary digits to a single character and returns them as either a table of strings or a singular string.[/indent]
[indent=2]If the second argument is a table that will be used rather than the other arguments.[/indent]
[indent=1]BrineFormat.TblStr(…)[/indent]
[indent=2]… = multiple Tables[/indent]
[indent=2]Combines all values in the tables into 1 string.[/indent]
[indent=1]BrineFormat.StrTbl(S, L)[/indent]
[indent=2]S = String[/indent]
[indent=2]L = Output String Legnth[/indent]
[indent=2]Separates S into a table with stings with length L.[/indent]
[indent=1]BrineFormat.SwapVars(V1,V2)[/indent]
[indent=2]Swaps the values of 2 variables.[/indent]
[indent=2]Usage: V1, V2 = BrineFormat.SwapVars(V1, V2)[/indent]

BrinePeripheral Functions
[indent=1]BrinePeripheral.ListType(T)[/indent]
[indent=2]T = Peripheral type you are searching for.[/indent]
[indent=2]Creates a table of all connected L peripherals[/indent]
[indent=2]Usage: Monitors = BrinePeripheral.ListType("monitor")[/indent]

Have any suggestions for a new API? Or for a new function in an existing API? I consider everything and credit those who contribute!

I am accepting new conversion Ideas for BrineConvert! Suggest them in a reply and they could be featured in BrineConvert! Credit will be given to those who contribute!

Download by using the command below!
pastebin run t0aw2K2m <Optional Install Directory>
Load all the APIs at once by running LoadAPIS (accessible from anywhere by typing /YOURINSTALLDIRECTORY/LoadAPIS)

The installer was made using Packager! you should go check it out!
Edited on 03 March 2018 - 05:16 PM
KidBrine #2
Posted 05 December 2017 - 11:13 PM
Added LoadAPIS for loading all the APIs at once!
KidBrine #3
Posted 06 December 2017 - 05:50 AM
BrineConvert has been added to the API list! Suggest a conversion we need for BrineConvert!
Luca_S #4
Posted 06 December 2017 - 04:20 PM
I would suggest using varargs for the average function.
KidBrine #5
Posted 06 December 2017 - 09:57 PM
I would suggest using varargs for the average function.
Implemented! Thanks for the suggestion! You are also now the first on the Contributors list!
Edit: also going to make my BrineConvert convert using the same system!
Edited on 06 December 2017 - 09:45 PM
CLNinja #6
Posted 06 December 2017 - 10:57 PM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
KidBrine #7
Posted 07 December 2017 - 01:28 AM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
Because i don't want to have the suggestions and the program separate.
CLNinja #8
Posted 07 December 2017 - 01:37 AM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
Because i don't want to have the suggestions and the program separate.

People can post "issues" on github which could very well include suggestions.
KidBrine #9
Posted 07 December 2017 - 02:15 AM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
Because i don't want to have the suggestions and the program separate.

People can post "issues" on github which could very well include suggestions.
If they can post the issues here I see no point in having them post issues on GitHub.
CLNinja #10
Posted 07 December 2017 - 02:41 AM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
Because i don't want to have the suggestions and the program separate.

People can post "issues" on github which could very well include suggestions.
If they can post the issues here I see no point in having them post issues on GitHub.
Lets say i have a change i want to recommend to you. I can take your code, clone the repo, and make the change in my code and pull request yours. If you like it, you can merge it easily.
Saldor010 #11
Posted 07 December 2017 - 03:29 AM
Lets say i have a change i want to recommend to you. I can take your code, clone the repo, and make the change in my code and pull request yours. If you like it, you can merge it easily.

Not everyone wants to have other people touching their code. There's a difference between someone suggesting a change, and someone overwriting work you did to make that change.
CLNinja #12
Posted 07 December 2017 - 03:55 AM
Lets say i have a change i want to recommend to you. I can take your code, clone the repo, and make the change in my code and pull request yours. If you like it, you can merge it easily.

Not everyone wants to have other people touching their code. There's a difference between someone suggesting a change, and someone overwriting work you did to make that change.
Thats why pull requests exist? You can either merge or not, at the discretion of the owner of the repo.
KidBrine #13
Posted 07 December 2017 - 06:11 AM
Instead of making these comments "contributers" why not use VCS like mercurial or github?
Because i don't want to have the suggestions and the program separate.

People can post "issues" on github which could very well include suggestions.
If they can post the issues here I see no point in having them post issues on GitHub.
Lets say i have a change i want to recommend to you. I can take your code, clone the repo, and make the change in my code and pull request yours. If you like it, you can merge it easily.
If you run the Pastebin program you have a full copy that you can modify on your own and then suggest that I use the modified code.
Lets say i have a change i want to recommend to you. I can take your code, clone the repo, and make the change in my code and pull request yours. If you like it, you can merge it easily.
If you run the Pastebin program you have a full copy that you can modify on your own and then suggest that I use the modified code.

Not everyone wants to have other people touching their code. There's a difference between someone suggesting a change, and someone overwriting work you did to make that change.
Thats why pull requests exist? You can either merge or not, at the discretion of the owner of the repo.
Then this quote above is true but not through GitHub.

If you want I can send you the code I use to combine everything into one file.
Edited on 07 December 2017 - 05:13 AM
CLNinja #14
Posted 07 December 2017 - 06:38 AM
My point isn't the fact that your code is impossible to edit, its that providing suggestions/issues here as well as potentially showing you code would get annoying.
KidBrine #15
Posted 07 December 2017 - 03:19 PM
My point isn't the fact that your code is impossible to edit, its that providing suggestions/issues here as well as potentially showing you code would get annoying.
What's the difference between showing me suggestions here and showing me suggestions on GitHub?
CLNinja #16
Posted 07 December 2017 - 08:52 PM
My point isn't the fact that your code is impossible to edit, its that providing suggestions/issues here as well as potentially showing you code would get annoying.
What's the difference between showing me suggestions here and showing me suggestions on GitHub?
A merge button to make it easy on you, organization, and easy to look at source code.
SquidDev #17
Posted 07 December 2017 - 09:23 PM
A merge button to make it easy on you, organization, and easy to look at source code.
If KidBrine is happy with their current system, I don't think there's much point in this discussion. Honestly, for a project this small GitHub does feel overkill.
KidBrine #18
Posted 07 December 2017 - 10:51 PM
A merge button to make it easy on you, organization, and easy to look at source code.
If KidBrine is happy with their current system, I don't think there's much point in this discussion. Honestly, for a project this small GitHub does feel overkill.
I have my own system for merging things. SquidDev is right if someone is happy with the way they do something leave it alone.
CLNinja #19
Posted 08 December 2017 - 12:11 AM
A merge button to make it easy on you, organization, and easy to look at source code.
If KidBrine is happy with their current system, I don't think there's much point in this discussion. Honestly, for a project this small GitHub does feel overkill.
I have my own system for merging things. SquidDev is right if someone is happy with the way they do something leave it alone.
You said make suggestions and i made a suggestion. Tadah.
KidBrine #20
Posted 15 January 2018 - 03:32 AM
Update notes:
  • BrineConvert has been renamed to BrineFormat.
  • BrineFormat can now convert Strings to tables and back.
  • BrineFormat Can Now Swap 2 Variables
New function usage can be found in the first post.
Stekeblad #21
Posted 15 January 2018 - 07:52 AM
BrineMath Functions
[indent=1]BrineMath.Average(T)[/indent]
[indent=2]T is many arguments no longer in the form of a table. (Thank You! Luca_S)[/indent]
[indent=2]Ex: BrineMath.Average(5,7,6,8,9,10)[/indent]
[indent=2]Returns 38.333333[/indent]
Are we thinking on the same avarage?
5+7+6+8+9+10 = 45
6 numbers
45 / 6 = 7.5
How do you get 38.33333 ???
KidBrine #22
Posted 16 January 2018 - 02:54 AM
BrineMath Functions
[indent=1]BrineMath.Average(T)[/indent]
[indent=2]T is many arguments no longer in the form of a table. (Thank You! Luca_S)[/indent]
[indent=2]Ex: BrineMath.Average(5,7,6,8,9,10)[/indent]
[indent=2]Returns 38.333333[/indent]
Are we thinking on the same avarage?
5+7+6+8+9+10 = 45
6 numbers
45 / 6 = 7.5
How do you get 38.33333 ???
I have absolutely no idea… BrineMath even agrees with you, So that means I was most likely half asleep when i wrote that.
KidBrine #23
Posted 25 January 2018 - 04:08 AM
Update - 1/24/2018 8:20 PM Pacific time
  • BrineFormat.TblStr() now supports multiple tables at once!
  • New Function BrineMath.Circumference()
KidBrine #24
Posted 16 February 2018 - 05:15 AM
Update - 2/15/2018 928 PM PST
  • BrineUtil.Update() added
  • BrineUtil.Uninstall() added
  • BrineUtil.VersionCheck() added
  • You can now choose a custom install directory for BrineUtil (The programs will adapt to this and you can even move the folder without needing to change the code in any of the files!
KidBrine #25
Posted 03 March 2018 - 06:17 PM
Update 3/3/2018 10:30 AM PST
  • API BrinePeripheral Added
  • BrinePeripheral.ListType() Added