Questions tagged [lua-api]

Anything related to Lua C Application Programming Interface (Lua C-API).

Lua has been designed to be easily integrated with C applications, thus it provides a rich API to interact with C code, which is called the Lua C-API.

The Lua C-API can be used both for:

  • enabling the Lua engine to communicate with an host application (the application which embeds the engine), and

  • enabling library code for Lua written in C to communicate with the Lua engine that loads the library.

197 questions
0
votes
1 answer

Howto detect that a Lua script is running on CORE?

I would like to code if (???) then -- Code which is intended to run specially on CORE ( e.g. special references to CORE objects ) else -- Code which is not intended to run on CORE ( e.g. the standard "require()",..) end How to do this? I guessed…
0
votes
0 answers

LNK2019 when using Lua from NuGet package

I'm trying to create a new project using lua library. So far, I've always used NuGet Lua for this, but now it suddenly stopped working. All my code is this: #include #include #include int main() { …
Sherlock Holmes
  • 191
  • 1
  • 8
0
votes
0 answers

How to block an Lua script from running

I am designing a RPG in C. It's gotten to the point that I've implemented a scripting system. I decided to embed Lua into my game. Currently I register a set of commands in C that I call in Lua. How do I block an Lua script from running until a…
0
votes
2 answers

Is a string necessarily smaller than a Vector3 in storage?

I'm working on a system in Core to save the transforms of furniture, specifically position and rotation, which are both Vector3's. I have these in player storage, so at some point to save all the player's furniture, I think I will end up maxing out…
0
votes
0 answers

How to deepcopy a Lua function using Lua C API?

As the title says. In theory the right functions to use would be lua_dumpand lua_load, but I've looked at their documentation and I have no idea on how to use them. What do I do? I need to deepcopy the function, because this copying will be also…
Sherlock Holmes
  • 191
  • 1
  • 8
0
votes
0 answers

Custom lua bytecode / opcode (compiler / reader / parser / decompiler)

01/02/05/70/72/69/6E/74/01/68/01/02/00/00/01/06/A3/00/00/00/A4/00/01/00/00/00/00/40/6F/01/02/00/9F/00/02/01/82/00/01/00/03/03/01/04/00/00/00/40/03/02/00/00/06/01/00/00/00/00/00/00/00 is bytecode for print"h" I need a way to make a compiler that…
sweetpeps
  • 23
  • 2
  • 6
0
votes
1 answer

Editing memory with a custom function in Lua C API

I'm trying to edit memory with my custom function in the luaC api but for example when i do like 3 lua_tonumber(LS, -1) it just gets mixed up? Please try to review my code and tell me how to fix this.. lua_State *L; using namespace std; DWORD…
sweetpeps
  • 23
  • 2
  • 6
0
votes
1 answer

Create 1d numeric lua table from C callback

How do I create a 1d numeric table from a C callback that may be called many times? The library provides the following callback function signature: int callback(int x, int y, int z, void *cb); Suppose it is called three times with the following…
ruser9575ba6f
  • 258
  • 1
  • 10
0
votes
0 answers

How to debug Lua extension randomly segfaulting

I am currently trying to write a tiny Lua extension to handle matrix multiplication. The matrix part of the job was fairly easy and I managed to expose it to Lua without too much effort. But now I face a strange issue, my Lua script randomly…
user6241056
0
votes
1 answer

How can I add custom option to toolbar in wireshark GUI?

I want to create a custom plugin which gets displayed on the tool bar in wireshark GUI. When the user clicks on the new custom option, then the custom lua script should be executed. How can I achieve this?
Rewanth Tammana
  • 1,453
  • 17
  • 20
0
votes
1 answer

How to dump contents of a table on the stack without modifying the stack?

First off I'm very much a n00b at Lua. Literally started yesterday evening. Btw, I'm using golua which as I understand it mirrors the usual C API quite closely. So any suggestions in C will likely apply to my case as well. Anyway, to the issue. I'm…
pythonator
  • 384
  • 2
  • 12
0
votes
0 answers

Can't open a C dll from Lua

I created a very simple C dll and I'm trying to load it using Lua interactive mode When I use require I get: error loading module 'LuaExperiment' from file 'C:\Lua\5.2.4\LuaExperiment.dll' The specified procedure could not be found When I use…
FinnTheHuman
  • 1,115
  • 13
  • 29
0
votes
1 answer

Executing a function for dissection in a Lua Wireshark dissector?

I have a Lua Wireshark dissector that is structured like so: -- Initialize Protocol -- Initialize Protocol Fields -- Register Protocol Fields -- DissectionFunction(tvbuf, pktinfo, root) -- Initialize Protocol -- Function definitions. I have a…
Irfan Hossain
  • 59
  • 1
  • 10
0
votes
1 answer

lua_tostring not working in SQL function in c code

I'm trying to apply my entry in the lua in a code for sql in C. My lua file has the following code: prepare_sql = { flvdb = "flv_database"; }; My lua code is as follows: lua_getglobal(L, "prepare_sql"); lua_getfield(L, -1, "flvdb"); p->flvdb =…
Chozie
  • 73
  • 1
  • 9
0
votes
1 answer

how to call lua operator in c?

The following example shows how the c program can do the equivalent to the Lua code: a = f(t) Here it is in C: lua_getglobal(L, "f"); // function to be called lua_getglobal(L, "t"); // 1 argument lua_call(L, 1, 1); // call "f" with 1…