Coder Social home page Coder Social logo

minilua's Introduction

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

  • 13-Nov-2023: Updated to Lua 5.4.6.
  • 28-Jan-2022: Updated to Lua 5.4.4.
  • 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.

minilua's People

Contributors

edubart avatar cloudfreexiao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.