EOSERV Forum > Programming > Help binding lua to c++ with luabridge
Topic is locked.
Page: << 1 >>
Help binding lua to c++ with luabridge
Author Message
Post #196030 Help binding lua to c++ with luabridge

I was wondering if anyone on here has any experience binding lua to c++. I'm using a library named luabridge at the moment to try and bind existing classes so they can be accessed from lua. For example, something like "world.ServerMsg("blah")" to display a server message. I need it to bind an existing class because making a new one and calling that wouldn't display the server message to the world being used. ;.; Please don't tell me adding lua to eoserv is dumb or pointless either. :l

9 years, 34 weeks ago
Post #196031 Re: Help binding lua to c++ with luabridge

Do you mean an existing object?

http://lua-users.org/wiki/CppObjectBinding

From here, i saw that you can just pass a void pointer to an existing object.

I know this has nothing to do with luabridge.

GameObject temp(20);
  temp.setMessage("I'm set in C++");
  
  // Push a pointer to this GameObject to the Lua stack
  lua_pushlightuserdata(L, (void*)&temp);
---
Remember when is not an organization nor a fucking group , it's simply an idea that we believe in
and live for.
The priority of Remember when should come before oxygen , as oxygen is cosmetic even life itself is
cosmetic,that's why offer our worthless lives to The "Remember when"
9 years, 34 weeks ago
Post #196032 Re: Help binding lua to c++ with luabridge

Thanks, this looks like it could help. Although I ended up making functions to call on the existing classes functions. Now I just need to figure out how to make something similar to util foreach in lua and ill be done.

9 years, 34 weeks ago
Post #196036 Re: Help binding lua to c++ with luabridge

Could you tell me why you are even bothering with Lua?

9 years, 33 weeks ago
Post #196037 Re: Help binding lua to c++ with luabridge

It's small and presumeably easy to integrate if you have a good enough knowledge of c++, unlike me. ;.;

9 years, 33 weeks ago
Post #196038 Re: Help binding lua to c++ with luabridge

I assume you learned Lua from Roblox? My little brother plays and knows all about that shit.

---
The good times are killing me.
9 years, 33 weeks ago
Post #196040 Re: Help binding lua to c++ with luabridge

No, actually I never learned it at all until I started integrating it into eoserv. Once you learn one language, you can learn others easier most of the time.

9 years, 33 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Programming > Help binding lua to c++ with luabridge