Small example of using Lua script for giving game objects some inteligence.
You can play with WASD the green rectangle and it can flee from red rectangle. You can also make changes in the enemy_ai.lua script during the gameplay and hit R button to reload the script.
This repository is used in an article on my blog, Lua for Dynamic AI in Games , in that article I explain in detail how some features from Lua were used in which case.
Installation depends on the platform, in Ubuntu Linux:
sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev liblua5.3-dev lua5.3 cmake
