Category Archives: Lua

lurlutil, a console manipulation library for lua : API documented

The cross-platform Lua wrapper of the console manipulation library rlutil seems to have arrived at a certain milestone:

https://github.com/d-led/lurlutil

The API has been expanded, converging on the original scope of rlutil.

Enjoy:

for i = 0 , 15 do
        lurlutil.setColor(i)
        io.write(i.." ")
end

and much more further console fun for Windows, Linux and MacOS X.

yet quicker start for a c++ project

The simplest way to try out some c++ concepts on your machine is the built-in build support of some ‘smart’ text editors, such as Sublime Text or SciTE. However, if you want to start quickly, but be able to grow the project from that one small seed, you’d probably want to have SCM set up.

To start cross-platform c++ projects I usually use git and premake. For premake I’ve set up a couple of quickstart scripts that implement some code organization conventions I usually follow. That project still requires one to set up a git directory, add a submodule, edit a premake4.lua file, write the first code file. How about automating these tasks as well. Every developer writes own support shell scripts, here’s one: new_cpp.sh that doesn’t do much – just what is described above. Considering, you have copied it somewhere where it’s executable globally, here are the steps:

  1. new_cpp.sh project_name → make the directory, init a git repo, add the premake submodule, the first source file and the premake4 build meta-configuration.
  2. cd project_name
  3. premake4 gmake → generate, makefiles, could be vs*, xcode*, too.
  4. make -C Build → build to see if everything is set up.

You can now start growing your code from project_name.cpp.

Quickstart for cross-platform c++ projects

A typical dilemma for a c++ developer is creating the initial build configuration. Out of my affection for Lua, I’ve collected my typical premake4 patterns into a separate project to be able to set up c++ projects on any platform within a minute.

Here’s a sample from selfdestructing:

_G.package.path=_G.package.path..[[;./?.lua;./?/?.lua]]
assert ( require 'premake.quickstart' )

make_solution 'selfdestructing'

includedirs { 
	'./selfdestructing',
	'./Catch/single_include'
}

make_console_app( 'selfdestructing-test', { './test/test.cpp' } )
make_cpp11()
run_target_after_build()