Play With Lua!

Archive for April, 2012

Lua Unicode Snowman For You

without comments

Short one this time:

print( string.char( 0xe2, 0x98, 0x83 ) )

If you have a console that supports UTF-8, you’ll see a barely recognizable glyph of a snowman. If you don’t, here’s what you’re missing.

(happens to be my second-favorite website of all time, behind this one)

The handiness of this for roguelike development is plain. There’s a good character list (with hex codes) here.

Written by randrews

April 27th, 2012 at 7:07 pm

Posted in Uncategorized

Colored text in Lua

without comments

If you, like me, are writing a text-mode Roguelike game in Lua, you’ll probably be interested in the thing I just published: a small Lua library for coloring text output to the console.

It lets you do things like this:

print(color.bg.green .. color.fg.RED .. "This is bright red on green")

Couldn’t be simpler. Enjoy!

Written by randrews

April 25th, 2012 at 7:18 pm

Posted in Uncategorized

Raw keyboard input

without comments

I’ve wanted to do a small case study of making an extension for a long time now. I’m writing a Roguelike game in Lua, so I had a need for one, and knocked it together last night: a C extension to provide Lua with a function to read one key from the keyboard.

Read the rest of this entry »

Written by randrews

April 22nd, 2012 at 3:43 pm

Posted in Uncategorized