Questions tagged [luabind]

Library to make bindings between C++ and Lua

Luabind is a library that helps you create bindings between C++ and Lua. It has the ability to expose functions and classes, written in C++, to Lua. It will also supply the functionality to define classes in lua and let them derive from other lua classes or C++ classes. Lua classes can override virtual functions from their C++ baseclasses. It is written towards Lua 5.x, and does not work with Lua 4.

177 questions
27
votes
1 answer

Handle event callbacks with Luabind

I'm adding scripting with Lua to an application of ours, and I need to implement bindings for the GUI-toolkit. The toolkit we use is wxWidgets. I'm using Lua 5.1 and luabind 0.9.1, and it has worked very well so far. However, I'm not sure how to…
Jonatan
  • 3,752
  • 4
  • 36
  • 47
9
votes
1 answer

LuaBind: How to bind specific instance of class to Lua?

(sidenote: This is game programming) Binding entire classes to Lua using LuaBind is easy: class test { test() { std::cout<<"constructed!"<
TravisG
  • 2,373
  • 2
  • 30
  • 47
9
votes
1 answer

Using luabind and std::shared_ptr with inheritance

I've got an API (a specific GUI library) that relies on std::shared_ptr a lot, i.e. they are often used as function parameters and stored within other objects. For example, container widgets, such as splitters and boxes will store their child…
ltjax
  • 15,837
  • 3
  • 39
  • 62
7
votes
2 answers

luabind - functions with more than 10 arguments

I would like to use functions with more than 10 arguments with luabind, but I get some C2784 and C2780 compiler errors (VS2012 Express). It seems that the problem is a limitation of the used boost library. In luabind it is possible to set the…
mspoerr
  • 2,680
  • 5
  • 32
  • 35
7
votes
1 answer

luabind: cannot retrieve values from table indexed by non-built-in classes‏

I'm using luabind 0.9.1 from Ryan Pavlik's master distribution with Lua 5.1, cygwin on Win XP SP3 + latest patches x86, boost 1.48, gcc 4.3.4. Lua and boost are cygwin pre-compiled versions. I've successfully built luabind in both static and shared…
qwer1304
  • 183
  • 1
  • 7
6
votes
1 answer

How to iterate through luabind class (in lua or in c++)?

How to iterate through luabind class (in lua or in c++)? class 'A' function A:__init() -- Does not work -- self is userdata, not a table for i, v in pairs(self) do end end Thanks
kFk
  • 409
  • 6
  • 13
6
votes
0 answers

Binding functions of derived class with luabind

I am currently developing a plugin-based system in C++ which provides a Lua scripting interface, for which I chose to use luabind. I'm using Lua 5 and luabind 0.9, both statically linked and compiled with MSVC++ 8. I am now having trouble binding…
Anamon
  • 73
  • 5
5
votes
1 answer

luabind and static fields

I'm trying to export static fields from class: class Foo { const static int Var; }; // luabind module: .def_readonly("Var", &Foo::Var); // I've also tried .def_readonly("Var", Foo::Var); error: no matching function for call to…
Max Frai
  • 61,946
  • 78
  • 197
  • 306
5
votes
1 answer

luabind: Can't call basic lua functions like print, tostring

A very basic question i guess: The C++ code, calling lua looks like this: lua_State* m_L; m_L = lua_open(); luabind::open(m_L); luaL_dofile(m_L, "test.lua"); try { luabind::call_function(m_L, "main"); } catch (luabind::error& e) { …
chris.schuette
  • 307
  • 2
  • 11
5
votes
1 answer

Need help understanding how luabind instantiates classes

Let's say I have a class like this: class A { public: A(){} ~A(){} }; And expose it to Lua via Luabind like this: module(luaState) [ class_("Foo") .def(constructor<>()) ]; And finally instantiate it in a script like…
Erius
  • 1,021
  • 8
  • 21
5
votes
4 answers

C++ class member function pointer to function pointer

I am using luabind as my lua to C++ wrapper. Luabind offers a method to use my own callback function to handle exceptions thrown by lua, set_pcall_callback(). So I paraphrased an example from the documentation, the changes being the logger->log()…
Brian
  • 145
  • 1
  • 3
  • 13
5
votes
4 answers

Automated Lua Binding using C++

I'm building a simple 2D game engine, and its getting bigger and bigger, exposing all of the function in Lua will be impossible: so I'm trying to automate a little bit the process, Is there anyway to get all the n arguments (with different types)…
Omarito
  • 577
  • 6
  • 22
5
votes
1 answer

Why can't I catch a luabind::error exception when my lua code throws an error?

When you call a LUA function from c++ and there is a runtime error LuaBind throws a luabind::error exception that you can catch and then read the stack to see what the error was. My debugger definitely catches this exception but when I let the…
Sean Dawson
  • 5,587
  • 2
  • 27
  • 34
5
votes
1 answer

How to bind a C++ function to lua that return multiple values with luabind?

It is possible, using luabind, to bind the following function? void retByRef(int &a, int& b) { a = 10; b = 10 } I was trying the following, but it is only working with functions that has one parameter def("retByRef", &retByRef,…
McLeary
  • 1,231
  • 2
  • 13
  • 21
5
votes
1 answer

Lua project compiling with errors (luabind)

I trying to make some HelloWorld with Lua + Luabind in Visual Studio 2010. I downloaded Lua src from here and added it's source files into project. Then I download and added source of luabind. Finaly added main.cpp. So after that tried to compile…
Edward83
  • 6,664
  • 14
  • 74
  • 102
1
2 3
11 12