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
5
votes
1 answer

C++ template method to create objects

I'm using Luabind to expose my game engine to Lua. I recently ran into trouble when I found out that there is no way for me to create a "new" e.g. GUIObject * obj = new GUIObject() in Lua, instead everything created within Lua is owned by Lua. Well…
OpticFroggy
  • 97
  • 2
  • 10
4
votes
1 answer

Problems with overload function and luabind

I have a class that I want to bind to lua. The reduced code might be: class CSprite2D{ void setPosition(glm::ivec2 val) { m_position = val; } void setPosition(int posX, int posY) { m_position.x = posX; m_position.y = posY; } static void…
Killrazor
  • 6,856
  • 15
  • 53
  • 69
4
votes
1 answer

Lua shutdown/End of the program execution callback

I am writing a module for Lua. On closing the lua interpreter it must run clean up routines even if user forgets to call shutdown routine implicitly. The module is mostly written in C. What callback in Lua C Api should I use to detect end of…
Boris
  • 1,311
  • 13
  • 39
4
votes
2 answers

error C2665 when building luabind

I'm using Lua5.1 and Boost 1.58.0 to try and build luabind-0.7.1-rc1. Environment variables are all set properly. I've been searching for an answer for this for about a week now without success. Whenever I try to build luabind I get 20 of the same…
Alex Meuer
  • 1,621
  • 3
  • 26
  • 37
4
votes
1 answer

Pass C++ Object so Lua can use it

I understand with Luabind that I can expose classes and then instances of those classes can be created in lua. module[L_state] [ class_("Player") .def(constructor<>()) .def("Update",&Player::Update) …
user441521
  • 6,942
  • 23
  • 88
  • 160
4
votes
1 answer

My lua script load .so library, how can I write the host program with Lua 5.2?

I searched and tried for days. The problem is this: I wrote a script which load a shared library locker.so, it runs well with lua interpretor, but I can not write out the correct host program. My lua script load_so.lua is very simple: locker =…
eddix
  • 133
  • 7
4
votes
1 answer

Luabind: Can't return shared_ptr

I'm trying to return an std::shared_ptr from a method bound with Luabind, but it doesn't seem to recognize the type. Luabind code: module(lua) [ class_ > ("Character"), …
tacospice
  • 647
  • 5
  • 20
4
votes
0 answers

luabind 'Trying to use unregistered class' on return

I'm currently using luabind to bind a class (sf::Time from SFML 2.0 to be exact), and I keep getting an exception from luabind. Here is my binding code: using namespace luabind; module(L, "system") [ …
Sam Bloomberg
  • 705
  • 1
  • 6
  • 23
3
votes
1 answer

Luabind and coroutines

I'm having some trouble understanding how to use coroutines properly with luabind. There's a templated function: template Ret resume_function(object const& obj, ...) Where (Ret) is supposed to contain the values passed to yield by…
Xtapolapocetl
  • 613
  • 5
  • 21
3
votes
2 answers

Assertion failure in Luabind

I am currently having problems using Luabind to interface a Lua scripted AI with a C++ game. I call an update function inside a loop (once per frame) and this function retrieves informations from C++ functions registered in Luabind. My problem is as…
Jean-Baptiste
  • 503
  • 5
  • 9
3
votes
1 answer

How do I prevent the creation of a new property in a Luabind class?

I'm using Luabind to bind C++ classes to Lua. From the Lua script, I can add arbitrary properties (key/value pairs) to the tables that represent my classes, even if I never told Luabind these properties exist: cheese = Cheese() cheese.type =…
May Oakes
  • 4,359
  • 5
  • 44
  • 51
3
votes
2 answers

Game NPC multi-action lua script design

I need to put scriptable NPC in my currect game project. The project itself is developed in C++ language. I will using Luabind to bind lua and c++. I need to call NPC function when certain NPC clicked or timer to do something is activated. Currently…
flamemyst
  • 1,187
  • 7
  • 10
3
votes
0 answers

Luabind and class instances

I'm working on a data driven game engine and I'm seeking to integrate lua. I seem to be having an issue binding instances of the current component class to a lua meta-table using luabind. Here's the problematic code: void…
Antonis Kalou
  • 354
  • 5
  • 7
3
votes
2 answers

Storing a lua class with parent in luabind::object

Using C++, lua 5.1, luabind 0.7-0.81 Trying to create a lua class with parent and store it in a luabind::object. Lua class 'TestClassParent' function TestClassParent:__init() print('parent init\n') end function TestClassParent:__finalize() …
kFk
  • 409
  • 6
  • 13
3
votes
2 answers

Lost references in Lua

Having a problem with objects, not needed any more but still having references. Result: size of allocated memory is constantly growing due to not collected objects. How to solve this sort of problem? Is there any way to find objects with only one…
kFk
  • 409
  • 6
  • 13
1
2
3
11 12