3rd January 2025 - 23rd January 2025
Lua
Kevin Hoefman's GameEngine
C++
Git
Github
CMake
This project taught me how it is possible to bind features, made in C++, to Lua. Breakout is made completely in Lua while I was figuring out and setting up the binding structure in the provided engine. When the complete binding structure was set up and Breakout was finished, I had 1 day left and decided to try and make a simple Tetris remake so I could try to set up a simple drag and drop system for Lua projects.
Using the SOL2 library we are able to bind our engine features to lua.
To create a new binding, you specify the type of a specific feature and provide the names and signature of all the public elements that you need in your Lua script.
If you want to bind various overloads of a specifc function, you'll need to use the provided sol::overload function and resolve the different overloads.
After this, your feature will be available for ues in Lua.
Lua is dynamically typed, ‘typing’ info can be provided by adding custom annotations.
Using the EmmyLua extension, we are provided with auto-complete &
type-checking definitions for Lua types created in C++.
By dragging a lua script onto the executable, the script's filename is entered as a commandline argument.
Using CommandLineToArgv() and C++17's std::filesystem, the project is able to retrieve the commandline arguments.
The filename can be retrieved from the commandline arguments and used to load the script.