Library for the minecraft mod ComputerCraft/CC: Tweaked to print in terminal with indentation
FileUtils can be installed using the ComputerCraft Package Tool by using the following commands:
Install CCPT, only run if you havn't installed it yet:
pastebin run syAUmLaF
If you install CCPT, this library will also be installed as CCPT depends on it. The library has the ccpt ID "pprint":
ccpt info pprint
The library will now be stored in "/lib/properprint".
- As shown here, when using the function properprint.pprint([texttoprint]), every line from the second line onwards has one space of indentation.
Content of 'test':
os.loadAPI("properprint")
properprint.pprint("The quick brown fox jumps over the lazy dog. He broke his legs in the process.")
Output:
2. As shown here, when using the function properprint.pprint([texttoprint],[indentation]), every line from the second line onwards still has one space more of indentation, but every line has the specified amount of spaces as indentation added by default.
Content of 'test2':
os.loadAPI("properprint")
properprint.pprint("The quick brown fox jumps over the lazy dog. He broke his legs in the process.",5)
Output:
3. As shown here, you can use the function getLastCharPosition([haystack],[needle]) to find the last position of a character in a string. Though that's not the main purpose of the library and appeared more as a helper function, maybe it's useful to you.
Content of 'test3':
os.loadAPI("properprint")
print(properprint.getLastCharPosition("So long, and thanks for all the fish!","l"))
Well, thats basicly all there is to say! This library is very small, but it is what it is. If you find bugs, please report them so I can fix them.
This is my first time publishing something on github, so feel free to point out things I could do better. Also, english is not my first language, so if you find any spelling/language-related mistakes, please tell me.
Have a nice day,
PentagonLP