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".

0
votes
1answer
13 views

Is Corona SDK fast enough for a Dwarf Fortress like game?

I want to make a dwarf fortress like game. Would the Corona SDK be fast enough? How would I store the data for each individual block. Since I can't make an enum in Lua, how would I define the type of ...
0
votes
0answers
23 views

Can Logitech G-series Keyboard Lua scripts be executed outside of the Logitech Gaming Software?

I would like to change the keyboard LED color directly with a Lua script. If Lua scripts can only be executed via a profile in the Logitech Gaming Software, is there any documentation on changing ...
0
votes
0answers
24 views

How to get the serial number of the hard disk using Win API on Lua

local ffi = require("ffi") ffi.cdef[[ int __stdcall GetVolumeInformationA( const char* lpRootPathName, char* lpVolumeNameBuffer, uint32_t nVolumeNameSize, uint32_t* lpVolumeSerialNumber, ...
0
votes
0answers
12 views

OpenWrt - LuCI - LUA - Controller order loading

I have a question on LUA/LuCI. I want to add mymodule at the end of index table in the function createindex. In this code: local controllers = { } local base ="%s/controller/" % util.libpath() ...
2
votes
1answer
18 views

How to check if a table contains some key inside __index?

I want to optimize a Fibonacci function but using table index, and memoization seems a good method (iteration is as good)... However, soon I ran into a problem: I can't decide whether a key is in a ...
1
vote
0answers
17 views

String.match in read mode *line [on hold]

I have a problem when using string.match in read mode line file:read('*line') For example, case 1 : str = print([[this is line breaks]]) Result : str:match('print') --print([[this is I've tried ...
1
vote
1answer
32 views

How to get all values from array by using lua

I have a multidimensional array: result = { { data = { language ="English", name ="Freak Out", list = { { type ="songs", album ="1234" }...
0
votes
1answer
47 views

How to separate emojies in string without spaces in LUA 5.1

I want to use split function of LUA 5.1 to split string of emoji characters without spaces and add space between ones, but I can't do it rightly. So I do it by this way, but it's wrong: #!/usr/bin/...
0
votes
1answer
22 views

Pass POST data to unix domain socket through nginx

I have a unix domain socket file and it is working with with nc command. Now I want to access it via nginx but it does not work. Am I missing something? test with nc => it works $ echo '{ "method" :...
-1
votes
1answer
27 views

How to dump a string as bytecode

So i'm making a lua script obfuscator, and i have the script in a string, i would like to call string.dump on it but it only accepts functions so i would like to know if their is any alternative, i ...
0
votes
0answers
13 views

Lua thru Snes9x - Reading/writing to active RAM trouble

I'm attempting to build a type of crowd control for a game that is run using an emulator, namely Snex9x. There is a version of Snes9x, called Snes9x-rr, that allows for Lua scripting to be executed ...
2
votes
1answer
26 views

How do I take out a value from a table in lua?

Now lets say I got a table like this items = { { ["name"] ='item1', ["prop"] ='prop1'}, { ["name"] ='item2', ["prop"] ='prop2'}, { ["name"] ='item3', ["prop"] ='prop3'} } If I where do take ...
1
vote
1answer
21 views

Am I able to use table.concat as a set of arguments?

I'm using LOVE2D to get used to lua a bit more, and I am trying to call a function to make a circle appear on screen, there's 5 arguments, and I have a table known as 'button' with the required ...
0
votes
2answers
24 views

How to change the titlebar's bgimage scale

I have a certain picture I want to turn into my titlebar background, but I don't know how to make it strech so it fits the entire titlebar. Any advice?
2
votes
2answers
43 views

Logitech Gaming Software lua script code for pure random numbers

I've been trying for days to try find a way to make random numbers in the logitech gaming software (LGS) scripts. I know there is the math.random() math.randomseed() but the thing is i need a ...
0
votes
0answers
9 views

How does wireshark dissection handle optional fields

For our senior project our team is trying to develop a tool to generate Wireshark dissection scripts in lua. We have not had too bad of a time so far, but we've recently started running into a few ...
0
votes
2answers
21 views

How would I undo the actions of string.gmatch for a certain section of string in lua

So I am using lua and splitting a string by spaces to write a sort of sub-language. And I am trying to have it not split anything inside parenthesis, I am already at the stage where I can detect ...
0
votes
0answers
11 views

HDF5 Error, unable to parse HDF5 header file at hdf5.h

I tried to run a Lua work on Ubuntu. With a conda environment, I already installed Lua 5.1, Luajit 2.0.5, Torch and used luarocks install --local hdf5 to install hdf5. However, when I tried to run the ...
1
vote
1answer
32 views

how to check liblua version at compile time?

working on some code that should compile against both liblua5.0 and liblua5.1, for example i need to call lua_openlibs(luaState); in 5.0 and luaL_openlibs(luaState); in 5.1 (lua vs luaL), how can i ...
0
votes
0answers
23 views

Lpeg: How to control output tree depth?

I'm trying to write a grammar for something like a book's contents list, which I can simplify to the following: Given input = [[ * A ** B *** C ** D *** E * F ]] Then the output should be this ...
0
votes
0answers
10 views

corona sdk trying to controlling character with keyboard input

if (event.keyName =='d' and event.phase =='down' ) then Chr.xScale = 1 Chr.x = Chr.x + 5 Chr:setSequence("Run") Chr:play() return true end I am trying to move my "Chr" to the right but when I ...
0
votes
2answers
42 views

How to check if multiple Lua tables contain common values?

I have a table of tables such as: local someTable = { idsA = {1, 2, 3, 4}, idsB = {4, 5, 6, 7}, idsC = {4, 8, 9, 10} } And need to check if there is a common value that exists ...
0
votes
4answers
45 views

Lua access indeces from table generated from JSON

So, I am bound to use Lua for getting weather data from the Openweathermap API. I managed to send a http request to return and store all data but now I am stuck with a Lua table I don't know how work ...
0
votes
1answer
38 views

how do I fix my script made in Roblox Lua?

I'm making my script and the Script Analysis tool says Error: (54,2) Expected , got 'end' I thought maybe you guys might help. Here is the code -- to be placed in StarterPlayer > ...
1
vote
1answer
35 views

vips - How to create justified text?

I'm using the vips library for manipulating some images, specifically its Lua binding, lua-vips, and I'm trying to create justified text images. I guess there is no available function in vips to do ...
1
vote
1answer
30 views

How to properly and efficiently shuffle a table's contents?

I'm trying to shuffle a table's contents randomly. It works fine, except sometimes it doesn't return all the contents of the table. I printed out some of the keys of the table before shuffling, and ...
0
votes
0answers
24 views

Lua execution blocked

I'm trying to run a function every frame with Lua (Binded to my C++ code). Everything works fine with this code (Called every frame, log correctly): Script.lua (OnUpdate function) function ...
0
votes
1answer
20 views

lua eventListener is calling method four times instead of just once

In my game (using Corona SDK) I want to spawn an enemy every 3 seconds. My spawnBlob creates only 1 blob at a time but four are appearing on screen at once every 3 seconds. I'm new at lua and corona ...
0
votes
1answer
39 views

LUA HMAC Generation issue in 5.1 version

I have an issue while I am creating the HMAC in LUA 5.1 version and same code is working in node.js Node.js Code : crypto.createHmac( CONSTANTS.HMAC_ALORITHM_SHA, Buffer.from( ...
1
vote
3answers
52 views

cmd new window store output

I want to open a new command prompt, run an program and save the output (which is right now displayed in the command prompt) in a logfile. I used this command so far: cmd /c start "window title" "...
1
vote
0answers
43 views

Lua print performance, Windows vs Linux

Using C, having typedef struct Entity { size_t id; char *luaFun; } Entity; and calling void LuaEntityUpdate(Entity *entity, double dt) { lua_getglobal(L, entity->luaFun); ...
0
votes
2answers
46 views

read html page in Lua

I want to read this page using Lua https://smart-lab.ru/dividends/index/order_by_t2_date/desc/ I can do it with python. It reads all I want: from urllib.request import urlopen txt=urlopen("https://...
1
vote
1answer
35 views

How to write haproxy check on 2 different servers in the same time maybe with a lua script?

I have 2 servers (A and B) for the same backend with one as backup but these servers depend on 2 others servers (A' and B') to work, one for each server : server A can be used if server A is up AND if ...
0
votes
0answers
23 views

Lua script - wrong CSS selector? “#tab-nav-main span:contains(desc)”

I'm using Scrapy-splash but this question is about Lua script. I need to wait until one element is visible. The problem is that this element can be navigated only using it's text. The equivalent ...
0
votes
1answer
31 views

Create interactive GTK interface through Lua

I'm building an application heavily reliant on plugins. These are coded in Lua for easier and faster development. I now want to add GTK user interfaces for the plugin's configurations. The problem ...
2
votes
1answer
20 views

Calling Orthanc's REST Api from Lua returns a “URI Badly Formatted” error

I am trying to anonymize images before sending them to another Orthanc server. According to the documentation on anonymization, Orthanc can anonymize images through the REST api: http://book.orthanc-...
1
vote
0answers
33 views

Lua: load one function from large library

I have a lua library QL.lua with many functions. I want only some of them. How can I load them? I want something like pythons option from socket import timeout I tried in lua local f = package....
0
votes
1answer
29 views

Convert a torch t7 model to keras h5

How can we convert a t7 model to keras' h5 ? I am trying to do so for c3d-sports1m-kinetics.t7 that you can find here https://github.com/kenshohara/3D-ResNets/releases The least I can ask for is a ...
1
vote
1answer
55 views

Embed luac-bytecode into C/C++ source-file

How do you include a lua-bytecode-string into a C/C++ file ? $ luac -o test -s test.lua $ cat test LuaS� xV(w@@A@$@&�printTestj Now if you could insert this byte-string into a C/C++-file, you ...
0
votes
1answer
33 views

lua error ends c# function and parent funtion execution

When i try to execute faulty lua code it does not only crash but completely ends the function execution that started the lua script. Some notes to read the following code: prs() is Debug.Log(). ...
0
votes
0answers
34 views

Lua Perlin Noise Gen gives strange patten

So i was making a mod for factorio which uses lua api. i need perlin noise generator so i coded one using a guide on a website: https://flafla2.github.io/2014/08/09/perlinnoise.html I first coded it ...
1
vote
1answer
49 views

What is the name of a variable when you make it from an array (table)

local text = {"One", "Two", "Three", "Four", "Five"} for k = 0, (#table - 1) , 1 do local options = { text = table[k+1][1], x = halfW, y = (150*k + 150) - 175, ...
0
votes
0answers
35 views

encode json array in lua

I need to encode a json object with an array from a lua table. function encode_flow_record(type,a, b, c) local i = 1 while (parent~= nil) do local array[i] = {f1=a,f2=b,f3=c} ...
0
votes
0answers
27 views

Lock mouse movement on Logitech mouse

I'm scripting my mouse to lock cursor movement when I hold a certain key down. I do this to enable mouse repositioning without lifting it. My script looks like so: myX = 0; myY = 0; action = true; ...
0
votes
2answers
86 views

What is the difference of pairs() vs. ipairs() in Lua?

In a for loop, what is the difference between looping with pairs() and ipairs()? This page uses both: Lua Docs With ipairs(): a = {"one", "two", "three"} for i, v in ipairs(a) do print(i, v) end ...
1
vote
1answer
34 views

What's the difference between elseif and else if in Lua?

What's the difference between elseif and else if in Lua? I don't know if they're the same but shorter. x= 100 y= 100 if x > 90 then ... else if y > 110 then ... else ... end end if x &...
0
votes
0answers
17 views

Authenticate requests are come to Nginx by database

I have an app that is using Mongodb, Nodejs, Nginx, Redis. Sometimse huge requests come to our server and Nginx as reverse proxy, will pass the request. I want to authenticate requests by database in ...
-1
votes
0answers
19 views

How to get items off from the lua stack in Sol2 usertype container trait for a generic container?

Using the Sol2 library I have a custom container registered with is_container<>. Sol managed to automagically bind every functionality except erase. After RTFM I tried to implement the erase ...
-1
votes
0answers
8 views

Facebook Deepmask error when running th train.lua

Hi there I could really do with some help regarding the following error. I am currently trying to run the Facebook Deepmask model (https://github.com/facebookresearch/deepmask) and have followed its ...
-1
votes
0answers
18 views

Regex for lua indenting

Im working with monaco with .NET and Javascript. I am setting up lua indenting as i will be using monaco for my text editor. I have tested a few of the regexes on the internet but none seem to solve ...

http://mssss.yulina-kosm.ru