Code Monkey home page Code Monkey logo

luapp's Introduction

luapp

An exploration of wrapping the lua C API with c++ constructs.

(currently a personal WIP)

Motivation

Extensibility is great. Safe and controlled extensbility is even more great. Lua is a well-known extension language and already has a C-based interpretter that supports a wide breadth of target platforms. It's easy to sandbox and doesn't suffer a deluge of poorly-performing or dependency-ridden libraries or builtins.

There are several existing c++ wrappers around lua, but I didn't really love any of them. In some cases, the performance or safety seemed suspect at first glance or the usage experience didn't strike me as optimal. Truth be told, I was also looking for an excuse to see if I could model things myself :)

Quick Usage

The [./simple_lua.cpp] file shows a quick example of how one might use the library to setup a standard CLI interpreter. The real power of the library comes with embedding and extending, not really in this way.

#include <iostream>
#include "State.h"
#include "luapp.h"

int main(int argc, const char** argv) {
  try {
    lua::State state;
    state.OpenAll();

    if (argc <= 1) {
      state.DoStdin();
    } else {
      state.DoFile(argv[1]);
    }
  } catch (const std::exception& e) {
    std::cerr << e.what() << std::endl;
    return 1;
  }
}

luapp's People

Contributors

cheezypoofs 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.