Hola te dejo un fichero con los fuentes de un programa realizado en C++ que utiliza lua como lenguaje de script a través de luabind, es una maquina de estados finitos realizada en lua, espero que te pueda servir:
http://www.telefonica.net/web2/yque/files/LuaCppFSM.zip
Te pego un ejemplo de ejecución del mencionado programa:
[C++Actor] constructor
[C++Actor_wrapper] constructor
[Miner] init is called from Lua 5.1
[C++Actor] constructor
[C++Actor_wrapper] constructor
[Wife] init is called from Lua 5.1
[C++Actor] Update---------------------------------------
Miner1: All mah fatigue has drained away. Time to find more gold!
Miner1: Walkin' to the goldmine
[C++Actor] Update---------------------------------------
Wife2: Washin' the dishes
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
[C++Actor] Update---------------------------------------
Wife2: Washin' the dishes
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
[C++Actor] Update---------------------------------------
Wife2: Makin' the bed
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
Miner1: Ah'm leavin' the goldmine with mah pockets full o' sweet gold
Miner1: Goin' to the bank. Yes siree
[C++Actor] Update---------------------------------------
Wife2: Makin' the bed
[C++Actor] Update---------------------------------------
Miner1: Depositing gold. Total savings now: 3
Miner1: Leavin' the bank
Miner1: Walkin' to the goldmine
[C++Actor] Update---------------------------------------
Wife2: Washin' the dishes
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
[C++Actor] Update---------------------------------------
Wife2: Washin' the dishes
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
[C++Actor] Update---------------------------------------
Wife2: Moppin' the floor
[C++Actor] Update---------------------------------------
Miner1: Pickin' up a nugget
Miner1: Ah'm leavin' the goldmine with mah pockets full o' sweet gold
Miner1: Goin' to the bank. Yes siree
[C++Actor] Update---------------------------------------
Wife2: Washin' the dishes
[C++Actor] Update---------------------------------------
Miner1: Depositing gold. Total savings now: 6
Miner1: WooHoo! Rich enough for now. Back home to mah li'lle lady
Miner1: Leavin' the bank
Miner1: Walkin' home
Instant telegram dispatched at time: 13 by 1 for 2. Msg is 1
Message not handled **********----------*******[C++Actor] Update---------------------------------------