Questions tagged [luaplus]

The LuaPlus distribution contains some modifications to the core Lua code base.

The LuaPlus distribution contains some modifications to the core Lua code base. As such, it is not an official distribution of Lua 5.1, nor does it intend to represent itself as one.

Benefits

The LuaPlus distribution provides the following functionality.

  • All the power of the core work distribution.
  • An optional high performance reference counted garbage collector.
  • The C++ interface, described below, masks many of the intricacies of core Lua's underlying low-level C API. In particular, stack management is mostly ignored. Other useful helper classes, such as management of ref'ed objects or the stack, table traversal, and table lookups are provided, dramatically simplifying the application code.
  • Simplified function calling convention. Inspired by, to a limited degree, Python's use of tuples in its C API, the new function calling convention masks the stack pushing and popping associated with the low-level calling convention.
  • Lua Core Enhancements:

    • 16-bit wide character string support.
    • Tight integration of the extra string type was necessarily built into the code base. Any reference to LUA_TSTRING in the Lua core code base was supplemented with an equivalent wide character LUA_TWSTRING.
    • Direct support for opening Unicode files available.

Useful Links

  1. Project page - http://luaplus.org/
  2. GitHub repository - https://github.com/jjensen/luaplus51-all
  3. Official boards - http://luaplus.org/projects/luaplus/boards

Tag Wiki credits to LuaPlus Project page

12 questions
6
votes
2 answers

LuaPlus: How to make a function return a table?

I'm wondering how I you can create and register a function from the C++-side that returns a table when called from the Lua-side. I've tried a lot of things but nothing did really work. :/ (sorry for the long code) This for example won't work,…
Forivin
  • 14,780
  • 27
  • 106
  • 199
3
votes
0 answers

Interface methods that need to accept ambiguous arguments?

Wasn't sure how to word the problem for the title of the post correctly. Here is the issue I am experiencing. We have an interface that will be implemented by our LuaStateManager class to register functions to a LuaPlus::LuaState. The issue is…
user3355098
  • 173
  • 7
2
votes
2 answers

LuaPlus create a Lua-table

How can I create a Lua-object like this: players = { { pos = {x=12.43,y=6.91}, backpack = {22,54}, health = 99.71 name = "player1" }, { pos = {x=22.45,y=7.02}, backpack = {12,31}, …
Forivin
  • 14,780
  • 27
  • 106
  • 199
2
votes
1 answer

Compilation error when using LuaPlus

I found a nice tutorial on how to implement LuaPlus into an C++ Project using Visual Studio 2010. http://www.zynox.net/luaplus-1-compiling-basic-usage/ But I can't get it to work because of some error messages.. mainproject\main.cpp(51): error…
Forivin
  • 14,780
  • 27
  • 106
  • 199
1
vote
1 answer

Binding a Lua table function to a C++ variable using LUAPlus

I want to link a Lua table function to a C++ variable using LUAPlus. So far using what information I can find on the web, I've managed to call a table function using DoString("tableName:functionName"), but I want to be able to call the function…
inzombiak
  • 171
  • 2
  • 14
1
vote
0 answers

LuaPlus: Register function with paramers and one return value?

I don't really understand the system. Using .RegisterDirect("myFunc",myFunc) I can register a function that can't take parameters, but therefore can return a value. Using .Register("myFunc",myFunc) I can register a function that can take parameters,…
Forivin
  • 14,780
  • 27
  • 106
  • 199
1
vote
1 answer

LuaPlus: How to push a table to the stack?

I want a function to return a (key-value-)table when called by a Lua-script. Therefore I have to push the table to the stack. I know how to push an integer to the stack: state->PushInteger(10) I also know how it works for strings and other numbers,…
Forivin
  • 14,780
  • 27
  • 106
  • 199
1
vote
1 answer

LuaPlus manipulate table from C++

In this guide functions are created to add a monster to a table and to decrease the health of a monster from the table. You can easily use the two functons like this from a lua script: monster = objectMgr:CreateObject("HotMamma",5); monster:Hurt( 1…
Forivin
  • 14,780
  • 27
  • 106
  • 199
0
votes
0 answers

Performing "true" dynamic casts at runtime?

So I am still working on a flexible scripting system for this school project and have come to a road block. The problem is this: I have a script state manager interface that any scripting state will implement (currently implementing lua, but want…
user3355098
  • 173
  • 7
0
votes
0 answers

Why can't I return a LuaObject in a function when using LuaPlus?

I am following an example in Game Coding Complete 4th Edition, which uses LuaPlus. In the example, and in any code i have tried myself, I am unable to register a function to lua if it has a return value of LuaObject. LuaObject…
user50286
  • 125
  • 2
  • 6
0
votes
1 answer

Why are there no header files to include when building LuaPlus?

From this question's answer, it seems as though this should be simple: How do you include LuaPlus into your project? This is absolutely ridiculous though. It is so dumb that you have to build this (along with such an awful website), but there are…
user50286
  • 125
  • 2
  • 6
0
votes
1 answer

LuaPlus: How to call Lua function from multithreaded C++?

I have a kind of callback function in my Lua script which I would like to call from different threads on the C++ side (0-100 times per second). So far it basically work, but as soon as I call it multiple times in a very short period of time it…
Forivin
  • 14,780
  • 27
  • 106
  • 199