Questions tagged [luabridge]

LuaBridge is a lightweight, dependency-free library for mapping data, functions, and classes between C++ and Lua.

LuaBridge is a lightweight C++ library that has no external dependencies. Its purpose is to make it easy to expose C++ functions and classes to Lua. LuaBridge has been tested and works with Lua revisions starting from 5.1.5, although it should work in any version of Lua from 5.1.0 as well as LuaJit.

64 questions
0
votes
1 answer

Read a list of parameters from a LuaRef using LuaBridge

[RESOLVED] I'm building a game engine that uses LuaBridge in order to read components for entities. In my engine, an entity file looks like this, where "Components" is a list of the components that my entity has and the rest of parameters are used…
jorgmo02
  • 41
  • 7
0
votes
2 answers

Export container class with LuaBridge

I want to export SRect and SRectVector from C++ to Lua, but compile fails. What is the proper way to do it? Compiler: vs2019, vc++11 OS: Win10 64 Push() meets compile error, I think the argument is just SRectVector *, why the compiler thinks it is …
zhk_tiger
  • 51
  • 3
0
votes
1 answer

LuaBridge Indescriptive errors

I use LuaJit and LuaBridge to compile lua code and execute it. When the lua code throws an error, it's really hard to debug - I don't know what line it happened or what caused it. This is an example: [string "1"]:0: bad argument #1 to 'info' (string…
0
votes
2 answers

How I can load multiple scripts without variables problems

I have a class with which I read Lua and I want to make it so that you can load several scripts at once and do not conflict, that is, the value of Lua variables are saved in the first script when the other is executed. I expected the program to…
0
votes
1 answer

Pass C++ object to Lua function using LuaBridge or Lua

I have a big object constructed from C++ (that I have exposed to Lua) and I want to be processed in Lua. I can pass any simple type to a Lua function (int, string) using lua_pushinteger, lua_pushstring but not a C++ class. I have tried…
cprogrammer
  • 5,503
  • 3
  • 36
  • 56
0
votes
1 answer

C++ LuaBridge attempt to index a userdata value (local 'self')

I've created a wrapper around LuaBridge in my framework, so that I can easily swap out LuaBridge for an alternative library. I have certain classes that get registered with LuaBridge as part of my framework initialization. I can then access or…
Ramon Guerrero
  • 205
  • 1
  • 12
0
votes
0 answers

lua commandline crashes after executing script

After executing a script that uses our internal objects mapped using LuaBridge, the Lua commandline executable crashes. **Call Stack** Compiler.exe!l_alloc(void * ud, void * ptr, unsigned int osize, unsigned int nsize) Line 1003 …
TrustyCoder
  • 4,749
  • 10
  • 66
  • 119
0
votes
1 answer

error compiling lua bridge

i was trying the compile lua bridge from the repository https://github.com/vinniefalco/LuaBridge/releases However was getting the error C2953 'luabridge::FuncTraits': class template has already been defined LuaBridgeDemo …
TrustyCoder
  • 4,749
  • 10
  • 66
  • 119
0
votes
1 answer

LuaBridge running C++ main function in lua for Love2D

Here is my C++ main function : int main() { lua_State* L = luaL_newstate(); luaL_openlibs(L); getGlobalNamespace(L). beginNamespace("o"). beginClass("Object"). addConstructor(). …
user5370661
0
votes
3 answers

How do I use operators in LuaBridge

I'm trying to export my vectors class .beginClass("Vector") .addConstructor() .addConstructor() .addFunction("__eq", &Vector::operator==) …
ar1a
  • 374
  • 3
  • 10
0
votes
0 answers

in c++, luabridge::LuaRef:no appropriate default constructor available

I write a lua script and want to parse the script by c++ codes. In this script I have functions, and I want to get the function and save it for usage in the future. The main.cpp is like #include #include #include…
gladys0313
  • 2,569
  • 6
  • 27
  • 51
0
votes
1 answer

Error with "addProperty" in Luabridge

I have some very simple source code to expose a simple Foo class. main.cpp: #include #include #include class Foo { private: int number = 0; public: void setNumber(const int& newNumber)…
Ben Hollier
  • 585
  • 2
  • 11
  • 32
0
votes
1 answer

Is exposing some of SFML to lua with luabridge relatively easy?

I understand how to expose my own classes to lua, like this: lua_State* L = luaL_newstate(); luaL_openlibs(L); getGlobalNamespace(L) .beginClass("Foo") .addConstructor() .addProperty(/*Property Definition*/) …
Ben Hollier
  • 585
  • 2
  • 11
  • 32
0
votes
1 answer

Call Lua function from C++ using LuaBridge

I am having some trouble calling Lua functions from C++ using LuaBridge. The idea is that I want to call "Update" on the script on every game update in C++. The following code is what I have found online: LuaRef sumNumbers = getGlobal(L,…
Serguei Fedorov
  • 7,763
  • 9
  • 63
  • 94
0
votes
1 answer

Registering a class' function in LuaBridge, then calling it via a lua script?

Whenever I run the program, it prints nothing to the console. This works fine if I don't use a class and just do it all in main(). The moment I put it in a class, I start having problems. What am I doing wrong? using namespace…
user50286
  • 125
  • 2
  • 6