Skip to content

eleanxr/LuaCxx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LuaCxx

C++ wrapper for lua interpretator.

Install

cmake . && make && make install

Using

Include Lua.hh.

Create interpretator instance (util::Lua).

Add util::LuaClass base class to your one. Add static void export_me(Lua& vm) method to your class. It must looks like this one:

static void SomeClass::export_me(Lua& vm) {
    vm.export_class<SomeClass, SomeBaseClass>();
}

Add static void export_class(Lua& vm) method to your class. It must looks like this one:

static void SomeClass::export_class(Lua& vm) {
    vm.export_constructor<SomeClass, Arg1type, Arg2type, Arg3type>();
    // vm.export_constructor<SomeClass>();
    vm.export_function("static_method", &SomeClass::static_method);
    vm.export_method("simple_method", &SomeClass::simple_method);
}

Add static const std::string class_name() method to your class.

static const std::string SomeClass::class_name() {
    return "SomeClass";
}

Export prepared classes by export_me methods. Export functions and static methods by util::Lua::export_function method. Export methods by util::Lua::export_method method.

About

C++ wrapper for lua interpretator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published