Skip to content

Mostly Lua

Drew Wibbenmeyer edited this page Aug 31, 2021 · 1 revision

Mostly Lua

This example uses a minimum of C++ code and a maximum of Lua to make a useful example.

// main.cpp
#include "raylib-nuklear.h"
#include <toml++/toml.h>
#include <sol/sol.hpp>
#include "bde.export.hpp"
import bde.base;
import bde.errors;
import bde.engine;
import <cassert>;
import <string>;
import <string_view>;
import <vector>;
import <iostream>;
import <format>;

int main(int argc, char * argv[]) {
    return bde::Engine()(argc, argv, "example.lua").HandleError();
}
-- example.lua
function EngineDestructor()
    rl.TraceLog(rl.LOG_INFO, "EngineDestructor LUA")
end
function OnStartup()
    rl.TraceLog(rl.LOG_INFO, "OnStartup LUA")
end
function OnLoad()
    rl.TraceLog(rl.LOG_INFO, "OnLoad LUA")
end
-- function OnUpdate()
--     rl.TraceLog(rl.LOG_INFO, "OnUpdate LUA")
-- end
function OnRender()
    rl.DrawText("Hello, World from Lua!", 0, 0, 10, rl.RED)
end
function OnShutdown()
    rl.TraceLog(rl.LOG_INFO, "OnShutdown LUA")
end
Clone this wiki locally