A simple and easy-to-use Lua library to enjoy videogames programming

raylib-lua-sol Logo

raylib-lua-sol

Lua bindings for raylib, a simple and easy-to-use library to enjoy videogames programming, with sol (www.raylib.com)

raylib-lua-sol bindings are self-contained in a header-only file: raylib-lua-sol.h. Just include that file in your project to allow loading and execution of raylib code written in Lua and Sol.

raylib-lua-sol could be useful for prototyping, tools development, graphic applications, embedded systems and education.

Ready to learn? Check out the code examples!

Example

local screenWidth = 800
local screenHeight = 450

InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")

SetTargetFPS(60)

while not WindowShouldClose() do
    BeginDrawing()
        ClearBackground(RAYWHITE)
        DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
    EndDrawing()
end
CloseWindow()

CLI

A raylib-lua-sol CLI launcher is provided. This launcher allows you to run raylib lua programs from command line, or just with drag & drop of .lua files into raylib-lua-sol.exe.

Note that launcher can also be compiled for other platforms, just need to link with Lua, raylib and sol libraries. For more details, just check comments on sources.

bin/raylib-lua-sol examples/core_basic_window.lua

Prebuild On Windows

Require:

Prebuild On GNU Linux

sudo apt install build-essential git cmake

Unbuntu

sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev

Fedora

sudo dnf install alsa-lib-devel mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel

Build

raylib-lua-sol uses cmake as a primary development target. Would appreciate adding more project templates, however.

git clone https://github.com/RobLoach/raylib-lua-sol.git
cd raylib-lua-sol
git submodule update --init
cmake -B build .
cmake --build build --config Release

Development

To run tests, use make test...

cd build
make test

License

raylib-lua-sol is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.

Copyright (c) 2019 Rob Loach (@RobLoach)

Comments
  • Vs2017

    Vs2017

    I've made some changes to CMakeLists, some included files and added some Windows instructions to Readme.md. Hopefully this won't break anything for Unix building..

  • Update raylib to 68f664a to fix some bugs in Android

    Update raylib to 68f664a to fix some bugs in Android

    When I included it in my Android project, example code only renders blank screen of various colours. Then I find it fix with in commit33ed14230608667c18b7d28d2f03722354e1c1a2. So I update submodule raylib to commit 68f664a, and re-bind Lua functions.

  • CMAKE_MODULE_PATH append not set

    CMAKE_MODULE_PATH append not set

    Your CMakeLists.txt has an error. set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") to list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") I am using addon for easy to setup by using FetchContent.

  • mac os compiling error

    mac os compiling error

    I started to compile on mac OS (el Capitan), and everything was going well until i ran cmake --build build. It got to about %50 done, then it threw this error:

    /Users/user/raylib-lua-sol/vendor/raylib/src/external/glfw/src/nsgl_context.h:38:10: fatal error: 'stdatomic.h' file not found #include <stdatomic.h> ^ 1 error generated.

    How can i fix this?

  • Does not compile

    Does not compile

    It fails compiling under Ubuntu 20 with

    [ 94%] Built target lua
    [ 97%] Linking CXX executable raylib-lua-sol
    /usr/bin/ld: ../liblua.a(loslib.c.o): in function `os_tmpname':
    loslib.c:(.text+0x18b): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
    /usr/bin/ld: CMakeFiles/raylib-lua-sol.dir/raylib-lua-sol.cpp.o: in function `raylib_lua_sol_rlgl(sol::state&)':
    raylib-lua-sol.cpp:(.text+0xce9): undefined reference to `rlUnproject'
    /usr/bin/ld: CMakeFiles/raylib-lua-sol.dir/raylib-lua-sol.cpp.o: in function `raylib_lua_sol_functions(sol::state&)':
    raylib-lua-sol.cpp:(.text+0xa867): undefined reference to `LoadImageEx'
    /usr/bin/ld: raylib-lua-sol.cpp:(.text+0xadb0): undefined reference to `ImageExtractPalette'
    /usr/bin/ld: raylib-lua-sol.cpp:(.text+0xc799): undefined reference to `SetMusicLoopCount'
    collect2: error: ld returned 1 exit status
    make[2]: *** [bin/CMakeFiles/raylib-lua-sol.dir/build.make:86: bin/raylib-lua-sol] Error 1
    make[1]: *** [CMakeFiles/Makefile2:970: bin/CMakeFiles/raylib-lua-sol.dir/all] Error 2
    

    I then took out ImageExtraPalette and SetMusicLoopCount from include/raylib-lua-sol.hpp but the rlUnproject and LoadImageEx undefied references stay.

  • CMake files do not automatically download the libraries when ran

    CMake files do not automatically download the libraries when ran

    Hi,

    The files FindSol.cmake and FindRaylib.cmake do not automatically download the libraries on OS X 10.15.1.

    If you change the flag QUIET to VERBOSE it fails but then carries on to download and building steps:

    
    find_package(sol 3.0 VERBOSE)
    if (NOT sol_FOUND)
      include(FetchContent)
      FetchContent_Declare(
        sol
        GIT_REPOSITORY https://github.com/ThePhD/sol2.git
        GIT_TAG 6d4a5d3ef66d605c54093edb673c14e373969a08
      )
      FetchContent_GetProperties(sol)
      if (NOT sol_POPULATED) # Have we downloaded sol2 yet?
        set(FETCHCONTENT_QUIET NO)
        FetchContent_Populate(sol)
        add_subdirectory(${sol_SOURCE_DIR} ${sol_BINARY_DIR})
        set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${sol_SOURCE_DIR}/cmake" "${sol_SOURCE_DIR}/cmake/Modules")
      endif()
    endif()
    
    

    The verbose flag is not valid so it carries on, i installed raylib view brew but it didn't find the libraries in the first place.

Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)
Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)

Regex_Engine Love 6's Blog Website: https://love6.blog.csdn.net/ Love 6's Regular Expression Engine Hope u can love my tiny regex engine :) maybe a fe

May 24, 2022
Mod - MASTERS of DATA, a course about videogames data processing and optimization
Mod - MASTERS of DATA, a course about videogames data processing and optimization

MASTERS of DATA Welcome to MASTERS of DATA. A course oriented to Technical Designers, Technical Artists and any game developer that wants to understan

Dec 28, 2022
A dependency free, embeddable debugger for Lua in a single file (.lua or .c)
A dependency free, embeddable debugger for Lua in a single file (.lua or .c)

debugger.lua A simple, embedabble debugger for Lua 5.x, and LuaJIT 2.x. debugger.lua is a simple, single file, pure Lua debugger that is easy to integ

Dec 31, 2022
The Lua development repository, as seen by the Lua team. Mirrored irregularly

The Lua development repository, as seen by the Lua team. Mirrored irregularly

Jan 5, 2023
Handcrafted Flutter application well organized and easy to understand and easy to use.

Handcrafted Flutter application well organized and easy to understand and easy to use.

Feb 1, 2022
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.

SynnixOS Epic Hobby OS targeting x86_64 CPUs, it includes some hacked together functionality for most essential OSs although, with interactivity via Q

Oct 28, 2022
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

Aug 20, 2022
Oct 6, 2021
A programming environment for Lua for the Raspberry Pi Pico microcontroller

picolua A programming environment for Lua for the Raspberry Pi Pico microcontroller. Version 0.3, April 2021 What is this? picolua is a proof-of-conce

Jan 8, 2023
The Lua programming language with CMake based build

README for Lua 5.1 See INSTALL for installation instructions. See HISTORY for a summary of changes since the last released version. What is Lua? Lua i

Dec 30, 2022
Turn your ESP32 into a easy to use micro web-server allowing to interact with any GPIO by simple http(s) calls.

WebhooksTriggeredESP32WiFi Turn your ESP32 into an easy to use and manage wireless micro web-server allowing it to process reliably and asynchronouly

Nov 24, 2022
Just a basic mini library for parsing simple files that only have variables written and with Lua extension.

C++ Parser Lua file config Just a basic mini library for parsing simple files that only have variables written and with Lua extension. Note: At the mo

Dec 26, 2021
Create simple visual sketches in Lua using SFML

Luna What is Luna? Luna is a simple game engine programmed in C++ and Lua which lets you create sketches and games in Lua Features Program in Lua, eas

Dec 9, 2022
A small and easy to use neural net implementation for C++. Just download and #include!
A small and easy to use neural net implementation for C++. Just download and #include!

NN++ A short, self-contained, and easy-to-use neural net implementation for C++. It includes the neural net implementation and a Matrix class for basi

Nov 11, 2022
Fast and easy to use, high frequency trading framework for betfair

Hedg Fast and easy to use, high frequency trading framework for betfair About Hedg In the sports trading industry, low latency is really important. Th

Jun 11, 2022
Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified source engine as well as their Easy Anti Cheat Implementation.
Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified source engine as well as their Easy Anti Cheat Implementation.

Apex-Legends-SDK Open Source Cheat for Apex Legends, designed for ease of use. Made to understand reversing of Apex Legends and respawn's modified sou

Jan 8, 2023
Gfx - A minimalist and easy to use graphics API.

gfx gfx is a minimalist and easy to use graphics API built on top of Direct3D12/HLSL intended for rapid prototyping. It supports: Full shader reflecti

Dec 29, 2022
MasterPlan is a project management software / visual idea board software. It attempts to be easy to use, lightweight, and fun.
MasterPlan is a project management software / visual idea board software. It attempts to be easy to use, lightweight, and fun.

MasterPlan is a customizeable graphical project management software for independent users or small teams. If you need to share plans across a whole co

Dec 23, 2022