Add Lua 5.4 scripting integration for dynamic game loading
- Integrated Lua 5.4 engine (32-bit mode for embedded ARM) - Created LuaGame wrapper class implementing Game interface - Added C++ bindings exposing renderer, game state, and input to Lua - Implemented SD card loader for automatic .lua game discovery - Updated GameLauncher to support std::function for lambda captures - Made Game class members public for Lua bindings access - Added example Lua games: counter, snake, bouncing ball - Included comprehensive API documentation Games can now be written as .lua text files on SD card and loaded without recompilation. Build size: 747KB UF2, Lua VM uses ~50-80KB RAM.
This commit is contained in:
23
games/lua_bindings.h
Normal file
23
games/lua_bindings.h
Normal file
@@ -0,0 +1,23 @@
|
||||
// ============================================================================
|
||||
// LUA BINDINGS - HEADER
|
||||
// ============================================================================
|
||||
// Exposes C++ game API to Lua scripts
|
||||
|
||||
#ifndef LUA_BINDINGS_H
|
||||
#define LUA_BINDINGS_H
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
}
|
||||
|
||||
// Forward declaration
|
||||
class LuaGame;
|
||||
|
||||
/**
|
||||
* @brief Register all game API functions with Lua state
|
||||
* @param L Lua state
|
||||
* @param game Pointer to LuaGame instance (stored as light userdata)
|
||||
*/
|
||||
void lua_bindings_register(lua_State* L, LuaGame* game);
|
||||
|
||||
#endif // LUA_BINDINGS_H
|
||||
Reference in New Issue
Block a user