Combining Modern C++ and Lua
summary
Describes a deployed architecture that moves a monolithic C++98 connection manager to C++17 actions + Lua 5.3 behaviors, using SWIG type maps to map std::string/vector/map and to pass Lua callbacks into std::function. Example code (luachat on GitHub) uses asio timers and TCP with one asynchronous TCP connection per message, speedylog for logging and CMake for builds. Field use on Blu Wireless train radios proves it allows live behavior changes without recompiles and speeds up fixes from week-long builds to monthly supported releases.
AI-written summary · about
chapters (30)
- 0:00Introduction
- 0:50Agenda
- 2:05Software Philosophy
- 4:10Example
- 4:40Plea Wireless
- 6:18Train radios
- 7:20Train environment
- 8:28Connection management
- 10:57Decoupled architecture
- 12:53Architecture diagram
- 14:20Questions
- 15:03What is Lua
- 17:23Lua Stack
- 18:50First Example
- 24:18LuaChat
- 27:18LuaChat Example
- 27:53Lua Architecture
- 28:44Swig
- 31:08Swig Input
- 33:11Macros
- 34:35Types
- 35:50Type Checks
- 40:30Lua Actions
- 43:28asynchronous messages
- 45:00accept
- 46:44asynchronous read
- 49:17get
- 49:37lower behavior
- 53:40code overview
- 54:01sender code
related talks
01h 33mC++20 + Lua = Flexibility
47mRapid Development of Software Solutions with C++ and Lua
01h 16mPolymorphism, Cohesion, and Coupling in C++
01h 16mApplied C++20 Coroutines
57mContemporary C++ in Action
44mUsing Modern C++ In Anger
01h 14mHow to Use C++20 Coroutines for Networking
01h 03mContemporary C++ in action
