• Stars
    star
    252
  • Rank 160,596 (Top 4 %)
  • Language
    C
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Single-file port of Lua, a powerful scripting language.

MiniLua

This is Lua contained in a single header to be bundled in C/C++ applications with ease. Lua is a powerful, efficient, lightweight, embeddable scripting language.

Example Usage

#define LUA_IMPL
#include "minilua.h"

int main() {
  lua_State *L = luaL_newstate();
  if(L == NULL)
    return -1;
  luaL_openlibs(L);
  luaL_loadstring(L, "print 'hello world'");
  lua_call(L, 0, 0);
  lua_close(L);
  return 0;
}

Usage

Copy minilua.h into your C or C++ project, include it anywhere you want to use Lua API. Then do the following in one C file to implement Lua:

#define LUA_IMPL
#include "minilua.h"

By default it detects the system platform to use, however you can explicitly define one.

Note that almost no modification was made in the Lua implementation code, thus there are some C variable names that may collide with your code, therefore it is best to declare the Lua implementation in dedicated C file.

Optionally provide the following defines:

  • LUA_MAKE_LUA - implement the Lua command line REPL

Documentation

For documentation on how to use Lua read its official manual.

Updates

  • 28-Jan-2022: Updated to Lua 5.4.3.
  • 31-Mar-2021: Updated to Lua 5.4.3.
  • 03-Dec-2020: Updated to Lua 5.4.2.
  • 27-Nov-2020: Library created, using Lua 5.4.2-rc1.

Notes

This library tries to keep up with latest official Lua release. The header is generated using the bash script gen.sh all modifications done is there.

License

Same license as Lua, the MIT license, see LICENSE.txt for information.

More Repositories

1

nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
Lua
1,986
star
2

otclient

An alternative tibia client for otserv written in C++11 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
C++
646
star
3

minicoro

Single header stackful cross-platform coroutine library in pure C.
C
619
star
4

sokol_gp

Minimal modern efficient cross platform 2D graphics painter in C
C
445
star
5

minivorbis

Single-file port of libogg and libvorbis for decoding ogg sound files.
C
62
star
6

lpegrex

Parse programming languages syntax into an AST using PEGs with ease (LPeg Extension).
Lua
60
star
7

lua-bint

Arbitrary precision integer arithmetic library in pure Lua
Lua
59
star
8

miniphysfs

Single-file port of PhysFS, a library that provides abstract access to various archives.
C
58
star
9

luamon

Live development utility for Lua inspired by nodemon
Lua
56
star
10

ddosmon

Live DDOS monitor in the command line using ncurses
C++
55
star
11

nelua-decl

C binding generator for Nelua using GCC Lua plugin.
Lua
46
star
12

riscvm

Tiny RISC-V virtual machine
C
46
star
13

arraymancer-vision

Simple library for image loading, preprocessing and visualization for working with arraymancer.
Nim
29
star
14

nelua-batteries

Lua
26
star
15

tetrix

Tetris like game made in Nelua for RIV fantasy console
Lua
23
star
16

nelua-vscode

Nelua syntax highlighting for Visual Studio Code
JavaScript
21
star
17

lester

Minimal Lua test framework
Lua
21
star
18

nelua-game2048

Clone of the 2048 game in Nelua using Raylib
Lua
21
star
19

android-libs

Port of C++ libraries to Android that I use in my projects
C
17
star
20

antcopter

2D speed run platformer, originally made for the WASM4 game Jam, now also a game in RIVES.
Lua
16
star
21

lunray

Ray tracing experiment in Nelua programming language
Lua
15
star
22

nelua-sublime

Nelua syntax highlighting for Sublime Text
14
star
23

arraymancer-demos

Demos and benchmarks of arraymancer (WIP)
Nim
14
star
24

forkmon

Watch for file changes and auto restart an application using fork checkpoints to continue the process (for quick live development)
C
12
star
25

nelua-benchmarks

Benchmarks for comparing efficiency of Nelua with Lua, LuaJIT and C
Lua
12
star
26

nldoc

Tool to generate documentation for Nelua source files.
Lua
10
star
27

euluna-binder

Smart C++ binder for lua
C++
9
star
28

srpmalloc

Fork of rpmalloc to be used with single thread applications and old C compilers
C
8
star
29

otml

OTML, a human readable and easy typing data serialization file format. This is a compact version of its emitter/parser extracted from OTClient in just one header with no dependencies.
C++
8
star
30

ioslibs

Build scripts that I use to build required libraries for my iOS projects
Shell
8
star
31

minialloc

Allocator using multiple pools for small allocations, in a single C header.
C
7
star
32

miniminiz

Miniz in a single C header.
C
7
star
33

bwrapbox

Linux sandboxing utility on top of bubblewrap
C
7
star
34

marcherstein3d

Realtime pseudo 3D raycaster on the CPU using 2D ray marching
Lua
7
star
35

nelua-lsp

Experimenting creating a minimal LSP for Nelua to be used for tooling in text editors
Lua
6
star
36

nelua-vim

Vim plugin for Nelua, originally created by Stefanos
Vim Script
5
star
37

seqtoy

Toy music sequencer written in Nelua for RIV fantasy console
Lua
5
star
38

gcc-lua

Mirror of https://git.colberg.org/gcc-lua with minor fixes.
C
5
star
39

cartesi-wasm-term

Cartesi Machine interactive terminal in the browser
C++
5
star
40

synack

Efficient network DDOS attacker tool for testing
C
5
star
41

lua-dumper

A small library for dumping lua variables quickly. This library is typically used for quick debugging values to the terminal where one would use print but want more information about the value (like table content), output to stderr by default (or other file handle) and optionally time elapsed.
Lua
5
star
42

nelua-webview-demo

Example using Nelua for WebView apps
C++
4
star
43

nelua-samples

Some sample applications write in Nelua
C
4
star
44

cartesi-doom-example

Cartesi Machine running DOOM example
C
4
star
45

lua-hasher

A small library with hash and encoding functions implemented in C. Currently supports blake2b hashing and base58 encode/decode.
C
3
star
46

neuralnet

Simple and compact neural network in C using backpropagation algorithm
C
3
star
47

aoc

Advent of Code 2020 in Nelua
Lua
3
star
48

riv

RIV game framework - WIP
C
3
star
49

fwmonitor

Lua
2
star
50

nelua-decl-extra

Extra bindings for Nelua that I won't maintain regularly
Lua
2
star
51

osxlibs

Homebrew formulas that I use for compiling libraries for my Mac OS X projects
Ruby
2
star
52

TibiaEye

Old project that I've found lost in an old HD, it was a functional TibiaCam in Qt
C++
2
star
53

hypervisor-playground

Playing with hypervisor, running guest machines inside a host machine being emulated
Makefile
2
star
54

glwall

Simple experiment for animated wallpapers in Linux using GLSL shaders
C
1
star
55

edubart.github.com

Ruby
1
star
56

bladebomber

Game made during first RIVES game jam to demontrate RIV C API
C
1
star
57

edubart

GitHub profile
1
star
58

minislirp

Libslirp modified to be easy to cross compile
C
1
star