luabind

Automated Lua Binding using C++

不羁的心 提交于 2020-01-14 18:51:56
问题 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) from the stack at once and inject them directly into the C++ function. I already automated functions args checking. still the function binding which is a little bit tricky For E.g: I have normal code for changing sprite position: int LuaSprite:

Automated Lua Binding using C++

£可爱£侵袭症+ 提交于 2020-01-14 18:51:29
问题 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) from the stack at once and inject them directly into the C++ function. I already automated functions args checking. still the function binding which is a little bit tricky For E.g: I have normal code for changing sprite position: int LuaSprite:

How do you set up LuaBind with visual studio 2012?

落花浮王杯 提交于 2020-01-14 03:52:09
问题 I've been trying to do this for a day. I've read through the documentation, and searched online for help. I just can't seem to figure it out between different versions of boost/lua/luabind used with precompiled headers, and VS2010 vs VS2012. I found a great website here http://blog.nuclex-games.com/tutorials/cxx/luabind-introduction/ but when I follow those instructions I get LNK2019 errors (I'm assuming because he build luabind/boost/lua for VS2010. I also found this, http://urbsch.at/?read

Calling C++ member function from Luabind causes “No matching overload found”

本秂侑毒 提交于 2020-01-01 07:21:34
问题 I've got some classes exported to Luabind in a DLL, and everything is working fine for those 2 classes (LuaScriptManager, EventManager). I can call their functions from Lua and all is well, but now I'm trying to setup some new class in my client executable which links with the DLL and so far no luck at all. Here's the error message I get for every function that I call: "No matching overload found, candidates: void loadResource(ResourceManager&, std::string const&)" The class binding is from

Lua project compiling with errors (luabind)

こ雲淡風輕ζ 提交于 2019-12-23 10:08:31
问题 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 project and got errors in mostly all luabind files: error C3861: 'lua_strlen': identifier not found error C2065: 'LUA_GLOBALSINDEX' : undeclared identifier Please help me what I did wrong? What files I must add to project? Maybe some additional

Storing a lua class with parent in luabind::object

谁说胖子不能爱 提交于 2019-12-20 02:45:27
问题 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() print('parent finalize\n') end class 'TestClass' (TestClassParent) function TestClass:__init() print('init\n') TestClassParent.__init(self) end function TestClass:__finalize() print('finalize\n') end C++ { luabind::object obj = luabind::call_function

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

夙愿已清 提交于 2019-12-14 04:22:58
问题 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 creating Another object in Luabind. If you don't know what I'm asking, You can continue reading. For example, i have three classes: Main , Test_Stage , Test_Class the Lua is created only in Test_class . I have a variable x ,created just for testing purpose.

luabind did not launch the function i had defined to it

最后都变了- 提交于 2019-12-14 03:17:45
问题 In a class called Test_Class, I have a function : shoot_a_bullet(int damage) { cout << "runned"; // i had #using namespace std } I had defined the code like following luabind::module(myLuaState)[ luabind::def("shoot_a_bullet", &Test_Class::shoot_a_bullet) ]; And follow code didn't give me an output on screen luaL_dostring(myLuaState,"shoot_a_bullet(134)\n"); PS:I did put cin.get() at the end, that's not the problem. edit: My main purpose of doing this is to let my scripted Character/Enemies

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

旧时模样 提交于 2019-12-13 05:16:02
问题 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 "lauxlib.h" } #include <luabind/luabind.hpp> #include <luabind/function.hpp> int main() { lua_State *myLuaState = lua_open(); luaL_openlibs(myLuaState); luaL_loadfile(myLuaState, "functions.lua"); luabind::open(myLuaState); int value = luabind::call_function<int>

Passing existing C++ objects to Lua and calling the passed objects' member functions

∥☆過路亽.° 提交于 2019-12-13 02:29:14
问题 I'm working on a little simulation project which uses Lua to drive the behavior of individual units (ants) and using Luabind to glue the C++ and Lua sides together. Each individual ant (there are different types, derived from the base class Ant) has a Run() function, which calls the appropriate script; the script then carries out whatever actions need to be taken, calling the exposed class functions and possibly free functions. I've gotten the Run function (in C++) to successfully execute the