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

How do you pass tables from C++ to lua using luabind?

I have a C++ function that I want to return a lua table luabind::object getPosition(void) { luabind::table=luabind::newtable(this->state); table["x"]=this->position[0]; table["y"]=this->position[1]; return table } The problem is…
user467526
  • 517
  • 5
  • 19
0
votes
1 answer

Luabind objects disapearing when I enter a new file

I'm using Luabind to bind my Lua scripts to my C++ engine. (it uses lua 5.1.4) I added a new lua script called "controller.lua" which my entities script, called "cat.lua", will reference and use. One the c++ calls the method "Update" it's all in the…
MintyAnt
  • 2,978
  • 7
  • 25
  • 37
0
votes
2 answers

Rather then create a object in lua, how let lua directly tall the C++ object to launch a method?

I'm using Luabind. My title might be kind of unclear, I will try the best i can to explain what i want to ask. My question is: How do i directly tall C++ object's method that can access the object's values(especially pointers) rather then…
MadokaMagica
  • 97
  • 1
  • 9
0
votes
1 answer

Crash when calling luabind function on object

When I try to run the "Run" function (defined in lua) from C++ (through luabind), I get the following error: Unhandled exception at at 0x767BC41F in Game_Launcher.exe: Microsoft C++ exception: luabind::error at memory location 0x001BF8B8. Using…
MintyAnt
  • 2,978
  • 7
  • 25
  • 37
0
votes
1 answer

Finite State Machine in Lua and C++

I want to create FSM in Lua (using Luabind). Let's say I have GameObject, in lua file I do write this: State1 = {} State1["Start"] = function() end State1["Update"] = function() if (blah blah blah) then ChangeState(State2); …
Alexey Teplyakov
  • 316
  • 3
  • 10
0
votes
1 answer

luabind compiling error occurs

I am trying to compile luabind which I got from this link. After I do mkdir build cmake .. make VERBOSE=1 "cmake .." produces these lines, -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C…
MWH
  • 399
  • 1
  • 5
  • 19
0
votes
2 answers

How to create a project in VS2010 by using cocos2d-x 2.1.4

I'm learning cocos2d-x and I want to create a project in VS, but I find that there is no template for VS, the version of cocos2d-x is 2.1.4. So I wonder what can I do to build a cocos2d-x project in VS2010 support both Lua and box2d Many thanks :)
Leo
  • 33
  • 5
0
votes
2 answers

Trying to change object value and reference value but not coordinates

I have this function local function cambiodesp(old,new) block[new]= block[old] end and i have this: random=4 local image = display.newImage(images[random], 0, 0) image.value = random image.x = 161 image.y = 451 block[0] =…
Rodrigo López
  • 227
  • 4
  • 17
0
votes
1 answer

Cannot change value of object in lua

i have a table(array) where i keep the references of some images. Here is the code: local rowcount = 8 local colcount = 4 local blockWidth = display.contentWidth / (colcount*4) local blockHeight = display.contentWidth /…
Rodrigo López
  • 227
  • 4
  • 17
0
votes
1 answer

Lua-bound singleton class crashes in destructor

I'm using Lua & luabind for the first time, and I've been wondering about the following issue. If I declare a singleton class in C++, and bind it to Lua, where I get its instance and call some methods, which language actually owns the instance? The…
Nelarius
  • 181
  • 2
  • 10
0
votes
1 answer

How to register member function with lua-function parameter using luabind?

I need to register a member function using luabind which is supposed to take a lua-function as parameter. For any normal function I would usually just do this: int SomeLuaFunction(lua_State *l) { luaL_checkfunction(l,1); int fc =…
Silverlan
  • 2,783
  • 3
  • 31
  • 66
0
votes
1 answer

Get information about splayd

I am using the SPLAY simulator for distributed applications and I want to submit a simple program that show a message and some info about the splayd that executes that function(like ID, name etc.) but I don't know how to get information about the…
0
votes
1 answer

How to get lua parameters in c?

I am using Visual C++ 2012 and trying to write a c extension for Lua. Currently I am design a function prototype: lib.myfunc(number, {a=1,b=2,c=3},{d=4,e=5,...}) There are 3 parameters for 'myfunc' function, the 1st parameter is a number of…
Mickey Shine
  • 12,187
  • 25
  • 96
  • 148
0
votes
1 answer

Luabind inheritance: self not defined

I just got myself into weird problem with Luabind. I want to inherit C++ classes from Lua, but the way described in Luabind documentation just doesn't work. function MyGame.__init() Game.__init(self) end This piece of code just crashes the…
Adam Tomeček
  • 199
  • 1
  • 15
0
votes
1 answer

luabind member function requires object as first argument

I'm having a very subtle problem with luabind v0.9.1 with g++ 4.7 (--std=c++11) and Boost 1.51 which can be reproduced in the following code: #include #include #include #include #include…
Travis Gockel
  • 26,877
  • 14
  • 89
  • 116
1 2 3
11
12