Why yet another Lua binding for raylib if there are so many others already out there?
Well most Lua bindings I have found on GitHub were using the LuaJIT "ffi" package, which is a viable option when using LuaJIT, but not for usage with vanilla Lua. And then, all the other bindings seemed to be abandoned for years and programmed against an ancient version of raylib. I also wanted to use the real C structures for objects and not parse Lua tables on the fly when using them.
Last but not least, fun. I just discovered raylib and I enjoy Lua programming, so I thought I would be a perfect side-project for me (and the upcoming raylib game jam).
- there are no UnloadXXX functions as the Lua garbage collector will collect and finalize unused resources
- all LoadXXXFromMemory functions are renamed to LoadXXXFromString which allows the user to pass a Lua byte string
- all GetXXXWidth / GetXXXHeight functions are renamed to GetXXXSize which will return 2 values for width and height
- all "basic" objects like Vector2, Vector3 etc. have a function named like this to create them
- e.g.
Vector2()
,Vector3()
,Rectangle()
,Camera2D()
,Camera3D()
- or with parameters like
Vector2(1, 2)
,Vector2(other_vector)
- e.g.
- all objects with resources bound to them like Image, Texture use the corresponding raylib function to create them
- vector objects Vector2, Vector3 take advantage of metatables so you can write simpler code
- you can add a vector with a vector or a number etc.
- e.g.
vector = Vector2(10, 10) * 100
- all functions which take an object as its first parameter are exposed as methods on the object itself
- e.g.
ImageColorInvert(image)
can be written asimage:ColorInvert()
- e.g.
DrawTextureV(texture, Vector2(10, 10), WHITE)
can be written astexture:DrawV(Vector(10, 10), WHITE)
- e.g.
- functions returning a FilePathList return a simple Lua array with strings instead
- module: rcore ๐ง
- Window-related functions โ
(100%)
- GetWindowHandle โ (useless in Lua)
- GetScreenWidth / GetScreenHeight ๐ GetScreenSize
- GetRenderWidth / GetRenderHeight ๐ GetRenderSize
- GetMonitorWidth / GetMonitorHeight ๐ GetMonitorSize
- GetMonitorPhysicalWidth / GetMonitorPhysicalHeight ๐ GetMonitorPhysicalSize
- Custom frame control functions โ (100%)
- Cursor-related functions โ (100%)
- Drawing-related functions ๐ง (64%)
- BeginTextureMode / EndTextureMode โ
- BeginShaderMode / EndShaderMode โ
- BeginVrStereoMode / EndVrStereoMode โ
- VR stereo config functions for VR simulator โ
- Shader management functions โ
- Screen-space-related functions โ
- Timing-related functions โ (100%)
- Misc. functions โ
- Files management functions โ (100%)
- Compression/Encoding functionality โ (100%)
- Input-related functions: keyboard โ (100%)
- Input-related functions: gamepads โ (100%)
- Input-related functions: mouse โ (100%)
- Input-related functions: touch โ (100%)
- Window-related functions โ
(100%)
- module: rgestures โ (100%)
- module: rcamera โ (100%)
- module: rshapes โ (100%)
- module: rtextures ๐ง
- Image loading functions โ
(100%)
- LoadImageFromMemory ๐ LoadImageFromString
- Image generation functions โ (100%)
- Image manipulation functions โ (100%)
- Image drawing functions โ (100%)
- Texture loading functions ๐ง (25%)
- LoadTextureFromImage โ
- LoadTextureCubemap โ
- LoadRenderTexture โ
- Texture configuration functions โ (100%)
- Texture drawing functions โ (100%)
- Color/pixel related functions ๐ง
- Fade is implemeted on the Color object
- Image loading functions โ
(100%)
- module: rtext ๐ง
- Font loading/unloading functions ๐ง (42%)
- LoadFontEx โ
- LoadFontFromImage โ
- LoadFontFromMemory ๐ LoadFontFromString
- LoadFontData โ
- GenImageFontAtlas โ
- Text drawing functions โ
(83%)
- DrawTextCodepoints โ
- Text font info functions ๐ง
- GetGlyphIndex โ
- GetGlyphInfo โ
- GetGlyphAtlasRec โ
- Text codepoints management functions (unicode characters) โ use utf8. module*
- Text strings management functions (no UTF-8 strings, only byte chars) โ use string. module*
- Font loading/unloading functions ๐ง (42%)
- module: rmodels โ
- module: raudio โ
(AudioStream)
- Audio device management functions โ (100%)
- Wave/Sound loading/unloading functions โ
- LoadWaveFromMemory ๐ LoadWaveFromString
- Music management functions โ
- LoadMusicStreamFromMemory ๐ LoadMusicStreamFromString
- AudioStream management functions โ
- module: raygui (3.2)
- Global gui state control functions โ
- Font set/get functions โ
- Style set/get functions โ
- Container/separator controls, useful for controls organization โ
- Basic controls set โ
- Advance controls set ๐ง
- GuiListView โ
- GuiListViewEx โ
- GuiTextInputBox โ
- Styles loading functions โ
- Icons functionality ๐ง
- GuiGetIcons โ
- GuiGetIconData โ
- GuiSetIconData โ
- structs (objects)
- Vector2 โ
- Vector3 โ
- Vector4 โ
- Quaternion โ
- Matrix โ
- Color โ
- Rectangle โ
- Image โ
- Texture โ
- RenderTexture โ
- NPatchInfo โ
- GlyphInfo โ
- Font โ
- Camera3D โ
- Camera2D โ
- Mesh โ
- Shader โ
- MaterialMap โ
- Material โ
- Model โ
- Transform โ
- BoneInfo โ
- ModelAnimation โ
- Ray โ
- RayCollision โ
- BoundingBox โ
- Wave โ
- Sound โ
- Music โ
- AudioStream โ
- VrDeviceInfo โ
- VrStereoConfig โ
- FilePathList ๐
- will be converted "in-place" to Lua tables in functions which will return this