Archive for April, 2012
Lua Unicode Snowman For You
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.
Colored text in Lua
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!
Raw keyboard input
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.