Questions tagged [lua]

Lua is a powerful, fast, lightweight, embeddable scripting language. It is dynamically typed, runs by interpreting bytecode, and has automatic garbage collection. Its speed is one of the main reasons it is widely used by the machine learning community. It is often referred to as an "extensible extension language".

5,773 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13 votes
1 answer
2k views

Storing Lua scripts with stackexchange.redis

I'm trying to use StackExchange.Redis on Azure WebApp and need to run some Lua scripts. The recommended way is to load the scripts to the server but I have difficulty understanding the correct ...
  • 3,473
8 votes
0 answers
9k views

Modify request body before PROXY_PASS

I have nginx setup that passes all request to nodejs, however I want to modify request body in nginx before passing it to nodejs. Like if body has http://www.example.com then replace it with https://...
8 votes
0 answers
1k views

how to implement a grpc client in lua at a bare minimum

I am trying to implement a grpc client in lua.After some exploration I think I need to 1)use a lua http2 library for the transport layer communication 2)prot0buf library for request and response ...
  • 5,215
8 votes
1 answer
306 views

Corona sdk display multi line notification

I have some notifications in Corona. The problem is, the text is too big, and I would need to show bigger (multi line) notifications, like the Gmail app, for example. Here is what the notifications ...
7 votes
0 answers
563 views

Missing dependencies for a module ltn12

I'm creating a module to send a mail using sendgrid (still very earlier stage) I have following rockspec package = "sendgrid" version = "0.1.0-1" source = { url = "git://github.com/meetme2meat/...
  • 413
7 votes
0 answers
598 views

Is it possible to manage a sticky table for rate limiting using HAProxy - Lua?

I am using HAProxy as a load balancer & i have a lua script which returns the backend name to haproxy.cfg. Wanted to implement rate limiting for my application. I know that we can use sticky ...
  • 71
6 votes
0 answers
618 views

multiple independent reference sections in Rmarkdown

I want to include separate references sections for main text and supplementary text in an Rmarkdown document. The approach suggested here and here largely works, but if there are references that ...
6 votes
0 answers
202 views

Equivalent of package.json/requirements.txt for luarocks?

Is there a file/format that I can save all the dependencies required for an application so that I can run luarocks install or something and reads all those dependencies and installs them in that ...
  • 31.5k
6 votes
1 answer
2k views

scrapy, splash, lua, button click

I am new to all instruments here. My goal is to extract all URLs from a lot of pages which are connected moreless by a "Weiter"/"next" button - that for several URLS. I decided to try that with scrapy....
6 votes
0 answers
770 views

Usage difference between SSL_add0_chain_cert and SSL_add1_chain_cert?

In OpenSSL documentation it says: All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied certificate or chain so it must be freed at some ...
  • 599
6 votes
1 answer
184 views

Race between socket accept and receive

I am using nodemcu with an esp-32 and recently came across an annoying problem. I refer to this sample from the NodeMCU Github page: -- a simple HTTP server srv = net.createServer(net.TCP) srv:listen(...
  • 17.9k
6 votes
1 answer
8k views

Speech streaming over Wifi

I have been trying to stream speech( May extend to audio) at 16Khz over the wifi HTTP TCP/IP. I have started of with ESP8266 wifi module considering its compatibility with Arduino and other platforms. ...
  • 83
6 votes
1 answer
572 views

naughty notifications with long messages

Is there a way to bypass the character limit of naughty's notification messages? I don't know what that limit is, but they seem to be getting truncated after a certain length. I'm using orglendar and ...
6 votes
0 answers
2k views

Binding functions of derived class with luabind

I am currently developing a plugin-based system in C++ which provides a Lua scripting interface, for which I chose to use luabind. I'm using Lua 5 and luabind 0.9, both statically linked and compiled ...
  • 73
5 votes
0 answers
882 views

I got this error after upgrading neovim to version 0.7.2-2

I try to update neovim, to the latest version,It installed correctly, but when trying to view the version (nvim -v) give me this error: vim/_init_packages.lua: cannot load incompatible bytecode stack ...
5 votes
1 answer
851 views

Scrapy splash not working correctly when searching for items loaded with JS

I'm using scrapy with scrapy splash to get data from some URLs such as this product url or this product url 2. I have a Lua Script with a wait time and return the HTML: script = """ ...
5 votes
2 answers
917 views

Parsing a JSON string that is bigger than the memory

The platform I'm working on has pretty tight memory constraints and I'm trying to find a way to parse big JSON strings without ever loading more than a few hundred bytes at max into the memory. The ...
  • 14.5k
5 votes
1 answer
1k views

Passing a C# object into a lua function with moonsharp.

I'm having issues using Moonsharp in Unity3d. I'm trying to pass 'AppletMessage' objects: [MoonSharpUserData] public class AppletMessage { public string Name; public string[] Args; ...
5 votes
0 answers
771 views

Can I get popups on mouseover for inline documentation in Sublime Text?

I'm used to Android Studio, which has these awesome popups when you hover your cursor over a function (or anything else), which shows you a description, parameters, etc.. Now I'm using Sublime Text 3 ...
  • 1,288
5 votes
3 answers
446 views

Can I make function `extern "c"`?

I have some cpp files, and I want to combine them with LuaJit using FFI. But the problem is that, I have to add extern "c" symbols for almost every function to make it possible for FFI to access them....
  • 186
5 votes
0 answers
2k views

Windows: fatal error C1083: Cannot open include file: 'lua.h': No such file or directory

I have tried to some requirements for a python project in windows, using pip install -r requirements.txt, however this keeps failing. After some investigation I have found that it fails because of ...
5 votes
1 answer
2k views

Cross compiling Lua and libs for embedded ARM device

Whats the best procedure to cross compile lua and libs (luasockets, orbit, etc) for an embedded arm device. Im able to succesfully cross compile lua interpreter, but from there im a little bit lost.
  • 558
5 votes
1 answer
7k views

What is newproxy and how is it useful?

I was messing around with Lua yesterday and stumbled upon the 'newproxy' function. http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#newproxy I kind of understand it, but I'm not ...
  • 693
5 votes
1 answer
755 views

How do you bind C++ member methods and member variables with the Lua C API?

All the googling I've done so far has turned up things that are very close but just aren't quite cutting it for what I'm trying to do. Let me describe this in the most basic way possible: Imagine ...
  • 141
5 votes
1 answer
10k views

Lua adding/changing global variables from C

I have a small Lua script: function g () print( AUp); end From C I load the script, add a variable with Name AUp and let it run a few hundred times. for( i=0; i<2000; i++) { num= i; ...
5 votes
4 answers
919 views

Linker errors using LuaJava on OSX 10.5

I'm having a bunch of problems getting this library to work on my OSX installation. In particular, I'd like to use it with a Java 1.6 VM but after I compile it up I get the following: java -cp "...
  • 22.7k
5 votes
1 answer
364 views

Lua session with limited C/C++ stack

I have to run Lua session safely in an embedded multithreading environment where the thread stack is pre-allocated and of a fixed size. It is allowed to have the script failed at Lua level due to ...
  • 8,610
5 votes
2 answers
6k views

Log upstream requests Nginx reverse proxy

I've built and configured a Nginx reverse proxy server. I've got logging set to include $upstream_http_location and other various variables. The server that I'm proxying to does not return a ...
  • 51
5 votes
3 answers
4k views

table.insert/remove by value

I got two tables, for example: table1 = { element1, element2, element3, element4 } table2 = { element1, element3 } Table 2 refers to some elements of table1, but I don't know which exactly, nor I ...
  • 846
4 votes
0 answers
714 views

"memory allocation error: block too big" doing simple integer division

I have a weird issue. LUA 5.3.5, compiled on STM32F429. Free RAM is about 1Mb (memory allocation is using external SDRAM, not the more limited internal RAM on the STM32). Note that working with ...
  • 51
4 votes
0 answers
3k views

Envoy Filter with a Lua script to fetch data from other API

I've got a Envoy Filter in which I add a header to every HTTP request. The header's value comes from API. Let's assume two configurations of the filter. In the configuration below I added a hardcoded ...
4 votes
0 answers
523 views

Monaco Editor - Adding monarch multi-line string token for Lua

So i'm creating a 'lua' tokenizer using Monarch and Monaco editor, I have the basic variables and stuff setup, but the only problem is I have no idea how to add a multi-line string. I see they did it ...
  • 51
4 votes
1 answer
114 views

Why -l option in lua interpreter acts strangely?

You can execute a sequence of chunks by giving them all as arguments to the stand-alone interpreter, with the -l option. For instance, if you have a file a with a single statement x=1 and another ...
  • 561
4 votes
1 answer
1k views

How to install Torch on Windows 10?

I try to install Torch on Windows 10 using this instruction. I followed most steps without any problems, but stumbled here: Generate user.lua file in C:\Users\Name.zbstudio: path.lua = [[C:\app\...
  • 448
4 votes
0 answers
214 views

Execution of Lua garbage collection causes C stack overflow

I am running Lua in microcontroller environment, using an RTOS. The available resources are very limited (only a few kb of RAM), and I am trying to make sure that Lua will work correctly in this ...
4 votes
0 answers
1k views

Modifying HAProxy Lua Library Path

I am trying to load Lua script from HAProxy. In the Lua script, the following line is causing an error: local http = require("socket.http") Intially I gathered from journalctl -xe output that the ...
4 votes
0 answers
380 views

ESP8266 NodeMCU - Meaning of E:M codes for memory issues

I'm working on adapting a clock program in NodeMCU. The program is reporting heap usage to the serial console every second. The heap is varying between 12360 and 12472 as it runs successfully for 15 ...
  • 1,951
4 votes
0 answers
1k views

wrk tool- How to pass multipart/form-data to wrk.format function

I am trying to use wrk for https request generation. How do I pass multipart/form-data request to wrk.format function. My request looks like Accept: application/json Content-Type: multipart/form-data;...
4 votes
0 answers
2k views

Get response body in Kong access log

I want to retrieve request and response body logs from Kong api manager. I have added new plugin (udp-log plugin) to kong, to get stream logs in Graylog dashboard. According to this link I have tried ...
  • 141
4 votes
0 answers
494 views

Nginx + Lua - Is it possible to set timeout for an endpoint in Lua code

We have the following configuration in the nginx. Inside lua file, we need to set parameters like timeout based on the configuration for the api endpoint. Can we set "ngx.var.proxy_read_timeout" to ...
  • 147
4 votes
0 answers
515 views

LuaLaTex using fontspec package and luacode reading JSON file

I'm using Latex since years but I'm new to embedded luacode (with Lualatex). Below you can see a simplified example: \begin{filecontents*}{data.json} [ {"firstName":"Max", "lastName":"...
  • 45
4 votes
1 answer
355 views

C++/Lua FFI to render userdata as a table?

I have the following simple code in C++ where Object is a std container: static int create_an_object(lua_State* L) { auto obj = static_cast<Object*>(lua_newuserdata(L, sizeof(Object*))); *...
  • 378
4 votes
3 answers
2k views

Comparing tables in lua, where keys are tables

I need to compare to see if two tables are equal - as in the same content. Both tables have tables as keys. For example: t1 = {{1,1},{2,2}} t2 = {{1,1},{2,2}} t3 = {{1,1},{2,2},{3,3}} t1 and t2 ...
  • 41
4 votes
0 answers
168 views

OP_JMP opcode scalability

My app uses a customized version of Lua 5.0.2 and some customers feed very large (automatically generated) scripts into it. For example, scripts that are 200 megabytes or more in size. It all seems to ...
  • 8,203
4 votes
1 answer
8k views

Openresty Hello world with docker

I'm trying make my application dockerize for that I've been following official openresty dockerfile. Os in my system is Ubuntu 16.04 64 bit. I have already pull that image using this cmd. docker ...
  • 943
4 votes
0 answers
201 views

Unexpected values from bit manipulations

I'm trying to build a dynamic byte array class for Lua 5.1/5.2. It's a very limited Lua server platform in a Flash game, they allow me do nothing more beside executing a single source code. Each byte ...
user avatar
4 votes
1 answer
158 views

Is this safe? (a take on deserialisation)

I wanted to be sure that the function below is 100% safe wrt code injection attacks. Specifically can anyone find an argument to the function below that allows the caller to retrieve a table with ...
  • 123
4 votes
0 answers
1k views

Sending data from NodeMCU to Raspberry Pi through MQTT with TLS

I've got a problem with sending data from NodeMCU to Raspberry Pi through MQTT with TLS. Configuration Raspberry Pi (with Minibian on board) runs a Mosquitto (version 1.4.11) broker. It is ...
  • 41
4 votes
0 answers
670 views

Lua script failed to load .dll written by C

Recently, I started to learn Lua language. And when I wanted to call C functions in Lua, I ran into some trouble. I wrote a .c file which defines some functions, and then compiled and linked it to ...
4 votes
0 answers
177 views

About Official Lua5.3 Implementation: Write Barrier

As this article about LUA gc mentiond, looking at "Tri-Color Incremental Mark & Sweep", at the end of that section, This is the GC algorithm used by Lua 5.1/5.2 and LuaJIT 1.x/2.0. It's an ...

1
2 3 4 5
116