Lua, C ++, any good introductions that go deeper than lua_open ()?

Now I googled a lot, but all I find are Hello World examples for Lua with C ++.

Situation: game, big game. It has a console built into the game, which is currently hardcoded in C ++ (object-oriented and all), it contains many if-else-if-else blocks ... for checking commands entered by the user in the console. Each team can change the members of other classes of the game (for example, the command "speed 5" changes the variable double speedin class Car, calling Car::setSpeed(5)), and also returns the result to the console about the result. There are also commands that execute more behind the scenes than changing a variable, this should also be done by Lua, and only the end result will return to the C ++ code (console output + changed variables in the correct class).

Where / how / where do I start converting the code behind this console console command in Lua? For example: the user enters "speed 5" in the console, then Lua calls Car::setSpeed(5), and then Lua sends back to the C ++ console. Instead of hard coding the code behind the commands, they should be written in Lua, but the rest of the game should remain in C ++ (for example, my classes, as well as members and console infrastructure).

Any good lessons? Any clues where to start? Some impressions to share?

Thanks in advance

+5
source share
2 answers

Lua, . , C (, , ++), 100 , " ".

++, ++ - RTTI, . , lua ++ Builder

+6

, lua .
luabind ++ lua. , .

0

All Articles