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
1
vote
1 answer

LuaBind and package.loadlib

I'm trying to go through the tutorial with luabind here, http://www.rasterbar.com/products/luabind/docs.html, however i'm having trouble loading the library. I'm currently using version 5.1 of lua, so I believe I would use package.loadlib instead of…
RedShft
  • 374
  • 2
  • 12
1
vote
1 answer

Luabind: Derived class as parameter

I've been learning Luabind recently with the intention of integrating into our software. I've run into a couple of problems and i've been looking at the Rasterbar Software documentation of Luabind and have not been able to solve it. Basically, i'm…
rocklobster
  • 609
  • 2
  • 10
  • 23
0
votes
1 answer

need to assign a global as a pointer and use it in lua

I am using luabind and I want to make this lua code work. print("hello..welcome to lua\n") base:PrintMe("printing from base" ) From c++, I want to assign the lua global variable "base" as a pointer to "Base" class. class Base { public: void…
madan kandula
  • 460
  • 5
  • 22
0
votes
1 answer

Push some data to Lua call function

I have two files - one for executing Lua script and the script itself. Here they are: host.cpp: #include #include using namespace std; int someHandler(lua_State *l) { int argc = lua_gettop(l); for (int i = 0; i <…
shybovycha
  • 11,556
  • 6
  • 52
  • 82
0
votes
1 answer

How do I solve LNK2005: already defined

I'm working on a project with Lua and Luabind to C++. Now, in every class I want to export to C++, I write a static method Register like this: In Button.h: static luabind::scope Register(); In Button.cpp: luabind::scope…
ThijsM
  • 200
  • 1
  • 14
0
votes
1 answer

Can Luabind property getters and setters yield?

Is it possible to create a Luabind property with getters and setters that yield while they wait for the query to be performed in a different thread? The following syntax compiles but doesn't seem to work: luabind::class_("Foo") …
Xtapolapocetl
  • 613
  • 5
  • 21
0
votes
0 answers

Dynamically loading executable in lua script

I’m having what I believe is a compilation issue while trying to use the luabind library. I’m following this tutorial and when I run the code as he has it – as in, the lua code is called from within the cpp file via the luastate – everything works…
jerry
  • 3
  • 3
0
votes
1 answer

Use LuaBind to call Lua functions inside a class when Lua is bound inside THAT class

Basically, I just want to be able to have a clean Lua instance made inside of my Manager class, then export the functions in the class to Lua, so that I can call functions on the already created C++ class inside of Lua. This is the current way I am…
user947871
  • 339
  • 6
  • 17
0
votes
1 answer

luabind can't cast my derived object to base class

I am trying to derive a class in lua(using luabind) that inherits from cpp bound class. But when I try to get a pointer to that class using object cast I get an error. Base Class: class System { public: virtual ~System() {}; …
0
votes
2 answers

Lua :- How to create a variable that can have mix data types and pass it as an argument

I have a requirement of passing data in arguments. Which can be 1) A Single String -> 'StringData' 2) Multiple Strings -> 'StringData0', 'StringData1', 'StringData2' 3) Single Numeric data -> 10 OR 30.22 4) Multiple Numeric data -> 10, 20, 30 OR…
sidd
  • 33
  • 5
0
votes
1 answer

lua-function as parameter for exported function

Is it possible to send lua-function to a main C++ program like this? function a() ... -- do something end cpp_exported_function(a); Or better, like this? cpp_exported_function(function () .... end); And how do I call it from the main…
Ben Usman
  • 7,969
  • 6
  • 46
  • 66
0
votes
2 answers

C++ not catching lua exceptions

I have a C++ program that I have bound to Lua using luabind. I am currently testing the error handling methods that lua and luabind have to offer in order to help with debugging the lua scripts down the road. The objective is to have luabind or lua…
Brian
  • 145
  • 1
  • 3
  • 13
0
votes
3 answers

Exposing an STL Queue to Lua via Luabind

I'm attempting to replace an existing implementation of a queue class written in Lua with the STL Queue class. I'm not sure why this is failing, or how to approach fixing it. Below is some sample code that exhibits the same behavior, along with the…
Joe
  • 4,585
  • 3
  • 37
  • 51
0
votes
2 answers

Does this script result in many, many closures, and if yes, whats an alternative?

I want to implement a GUI message handling system in Lua, currently it works like this: In the c++ code, windows have window procedures, like they have in the Windows API, and I am trying to lean on this in Lua as well. So my windows carry a…
Erius
  • 1,021
  • 8
  • 21
0
votes
1 answer

In C++, using luabind, call function defined in lua file?

Say I have a lua file: --functions.lua function testadd(a, b) return a+b end How would I use luabind to load that file, and call that function- something like: //test.cpp extern "C" { #include "lua.h" #include "lualib.h" #include…
Keelx
  • 907
  • 3
  • 17
  • 26