Coder Social home page Coder Social logo

nano-lua-dictionary-cpp's Introduction

Nano Lua Dictionary

Nano Lua Dictionary (or nano_luadict) is a simple C snippet that facilitates (with some compromises) the creation of Lua tables composed of K/V's (or dictionaries) as specified here. I made this nano-project to to aid in the creation of an event system for a rather simple Game Engine, and because integrating a huge Lua binding framework such as Luabind just to fulfill this propose seemed to be too much overhead for my personal needs.

C++ version

This is a fork of this library that is meant for C++. If you want a C version, go here.

Usage example

The project itself is self-explanatory, feel free to modify it to your needs, if you feel that a lot could be improved while maintaining simplicity and speed, just send a pull request :).

#include "nanoluadict.h"

luaDict(L                                           /* L is Lua State */
        , "sample_dictionary"                       /* Table name in global space */
        , 8                                         /* Number of kvs that we are including in our dictionary */
        , kvPairWithNumber("key1", 1)               /* Keys are always strings, this is a numeric value */
        , kvPairWithNumber("key2", 2)
        , kvPairWithString("key3", "string 3")      /* This is a string value */
        , kvPairWithNumber("key4", 4)
        , kvPairWithNumber("key5", 5)
        , kvPairWithNumber("key6", 6)
        , kvPairWithNumber("key7", 7)
        , kvPairWithCFunction("callback", c_function)); /* This is for a function callback */

nano-lua-dictionary-cpp's People

Contributors

goles avatar shellyherself avatar niedbalski avatar

Watchers

James Cloos 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.