ansicolors.lua

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

ansicolors.lua

Post by kikito »

ansicolors.lua simplifies the handling of colors on the terminal in Lua.
ansicolors.png
ansicolors.png (37.13 KiB) Viewed 4209 times
It can be helpful to easily separate errors from non-errors, or just to spice up some loading log.

The library can be downloaded from here:

https://github.com/kikito/ansicolors.lua

ansicolors.lua isn't 100% mine; it's actually a fork of this other lib. I used string interpolations instead of literals and functions like him. I've also added some rudimentary check for windows, so windows users don't get garbage on their console (call it "graceful degradation", if you might).

Let me know if you find any bugs or have any feature requests for it.

Regards!
When I write def I mean function.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: ansicolors.lua

Post by thelinx »

Sorry, but I don't see how this is related to LÖVE.
I'd suggest you post this to the Lua mailing list.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: ansicolors.lua

Post by ishkabible »

lol, shutdown. any way can you post some examples maybe?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: ansicolors.lua

Post by kikito »

thelinx wrote:Sorry, but I don't see how this is related to LÖVE.
I'd suggest you post this to the Lua mailing list.
As pretty much all the libs I've released so far, it's a Lua library, and it can work independently from LÖVE.

I realize that LÖVE's main interface is the LÖVE window, but the console is also there if you want to use it. So I guessed a little bling on that side wouldn't hurt.
ishkabible wrote:lol, shutdown. any way can you post some examples maybe?
Let me see if I can concoct something.
When I write def I mean function.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: ansicolors.lua

Post by BlackBulletIV »

Looks good mate! Reminds of that Richtext library that Robin had going.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: ansicolors.lua

Post by Robin »

BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
Speaking of whom, I heard he also wrote a similar library/function, for a Lua text adventure game library. It has HTML-like tags, and is semantically rather than presentation oriented. For example: "You grab the <o>Sword of Ultimate Justice</o>.", "Type <c>help</c> to get some help." or "On your left is a door to <r>the cellar</r>." or things like that. (o for object, c for command, r for room, you get the idea.)

Speaking of RichText, I really ought to update it or something. Write a decent word wrapping algorithm, for example.
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: ansicolors.lua

Post by TechnoCat »

BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
This is for your console output, not for things drawn to love.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: ansicolors.lua

Post by Robin »

TechnoCat wrote:
BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
This is for your console output, not for things drawn to love.
I assume he was thinking about the similar syntax.

Non-Existing-God, I really need to work on RT again. I haven't even reviewed luminosity's patch!
Help us help you: attach a .love.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: ansicolors.lua

Post by BlackBulletIV »

Robin wrote:
BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
Speaking of whom, I heard he also wrote a similar library/function, for a Lua text adventure game library. It has HTML-like tags, and is semantically rather than presentation oriented. For example: "You grab the <o>Sword of Ultimate Justice</o>.", "Type <c>help</c> to get some help." or "On your left is a door to <r>the cellar</r>." or things like that. (o for object, c for command, r for room, you get the idea.)

Speaking of RichText, I really ought to update it or something. Write a decent word wrapping algorithm, for example.
Are you speaking about yourself or kikito there? Either way, that sounds pretty cool.
TechnoCat wrote:
BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
This is for your console output, not for things drawn to love.
I know that; I was referring to the syntax (as Robin said) and the general idea.
luminosity
Prole
Posts: 34
Joined: Fri Sep 24, 2010 5:46 am

Re: ansicolors.lua

Post by luminosity »

Robin wrote:
TechnoCat wrote:
BlackBulletIV wrote:Looks good mate! Reminds of that Richtext library that Robin had going.
This is for your console output, not for things drawn to love.
I assume he was thinking about the similar syntax.

Non-Existing-God, I really need to work on RT again. I haven't even reviewed luminosity's patch!
I'm just on the verge of having a look at the word wrapping in RT to try to fix up the problems it's got for me. Just as soon as I fix the few hundred timing errors I introduced when I fixed a bug in my event system :/
Post Reply

Who is online

Users browsing this forum: zorg and 19 guests