Yes, there are alot of spring scripts, and probably you find that (hopefully not much) some of them have a very hard to read indentation (or none) and you will find yourself trying to decrypt that code while preparing your evil plan for killing the lazy programmer that didn't care his indentations
BUT NOW there is a partial solution for this problem, Cubex presents:
The Reindentator!
This Python written script will get a Source folder (yes a folder, for doing it automatically instead of one by one :D) and a Destination folder, then will proceed to walk across the files to find any lua script and will try to replace his indentation for a freshly automatic generated one :) saving you hours and hours of eye bleedings
Why? well, cause i tried to read PicassoCT made lua script's, they are with too badly indented and I am too lazy for reindenting all myself
WARNING! This script is nowhere near safe, it can containg undiscovered bug and behaviors, I tested myself with some badly indented scripts and works almost all cases, if you got "[ERROR] Negative Depth! Line...blablabla" means that my script can't resolve it or there is some missing end (don't trust, sometimes fails even with good if - end pairs :/, in case of failure the original file is copied to Dest folder without any modification)
tl;dr
Program for Reindenting scripts, Don't try to reindent a corretly indented script. Ony for emergency cases
How to use:
Needs Python 3 (Tested with Python 3.2, not sure if works with 2.x, but is sould...)
open console, run program with Reindentator.py and see help text
Lua Disclamer:
Cubex not harmed any lua script in the creation of this script
Too Lazy for Indentating mah scripts
Moderator: Moderators
Too Lazy for Indentating mah scripts
- Attachments
-
- Reindentator.zip
- The program, extract and run py
- (2.3 KiB) Downloaded 31 times
Last edited by Cubex on 10 Sep 2012, 06:18, edited 3 times in total.
Re: Too Lazy for Indentating mah scripts
i started out with the best of indentions...
Re: Too Lazy for Indentating mah scripts
If you can make those good 3d models im sure that you can put a little indention in make it more easily to readPicassoCT wrote:i started out with the best of indentions...
(don't take meme too seriously)
=EDIT=
Here you can see the difference betwen your Original script and a Parsed one
http://pastebin.com/KPn9f8QE
Re: Too Lazy for Indentating mah scripts
okay its better... but in a python-paralle-pimension Picasso punishes the Perpetrator to pulp
Re: Too Lazy for Indentating mah scripts
I knew we should have used Python. Indent or die!
Re: Too Lazy for Indentating mah scripts
They say that python isn't good idea for Spring due to its slowness but i would be happy to see some gadgets be able with classes or some python nice features
Re: Too Lazy for Indentating mah scripts
classes: https://github.com/Yonaba/Lua-Class-SystemCubex wrote:They say that python isn't good idea for Spring due to its slowness but i would be happy to see some gadgets be able with classes or some python nice features
Re: Too Lazy for Indentating mah scripts
Don't blame the language because a few users refuse to indent/properly format their code.
Re: Too Lazy for Indentating mah scripts
+1smoth wrote:Don't blame the language because a few users refuse to indent/properly format their code.
Re: Too Lazy for Indentating mah scripts
Too lazy to texture my own modells? Summone certainly is..
http://springrts.com/phpbb/download/fil ... ew&id=7538
Too lazy to downseizure the BandwithBunkerBusters? Someone curtainly is..
Well, there i was under the impression that - having each and everyone a own project at heart- you used the indention to skip reading into some other guys code.. but i was so wrong. Now after releas.. a endless queue has formed at the checkout of the journeywar repository.
Oh, wait no.. thats people leaving.. running.. strange phenomena. One even filed the newest phail of mine.. what have we here.
"Cant read code, if not presented in comic sans."
Guess that cant be helped.
One man project? One Man project!
http://springrts.com/phpbb/download/fil ... ew&id=7538
Too lazy to downseizure the BandwithBunkerBusters? Someone curtainly is..
Well, there i was under the impression that - having each and everyone a own project at heart- you used the indention to skip reading into some other guys code.. but i was so wrong. Now after releas.. a endless queue has formed at the checkout of the journeywar repository.
Oh, wait no.. thats people leaving.. running.. strange phenomena. One even filed the newest phail of mine.. what have we here.
"Cant read code, if not presented in comic sans."
Guess that cant be helped.
One man project? One Man project!
- Attachments
-
- cubExed.7z
- (855.24 KiB) Downloaded 68 times
-
- screen00455.png
- (1.82 MiB) Downloaded 2 times
Re: Too Lazy for Indentating mah scripts
==About lua classes==
I can live with tables for now ...
==About model==
Good work soon will appear in my game with connected nodes but why you posted in a thread about lua someone invented PM's
I can live with tables for now ...
==About model==
Good work soon will appear in my game with connected nodes but why you posted in a thread about lua someone invented PM's