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
0answers
6 views

Access full request URL in Lua with openresty?

How do I get the full URL of the current HTTP request in openresty's Lua? What I have in mind is the truly, really full URL string, one that will contain all the "exotic" parts if present: scheme ...
0
votes
0answers
8 views

Why is the core chat script stopping my entire game?

15:49:30.355 - BackgroundImage is not a valid member of Frame 15:49:30.356 - Stack Begin 15:49:30.357 - Script 'Players.Crusade_Commander.PlayerScripts.ChatScript.ChatMain.ChannelsTab', Line 212 - ...
0
votes
0answers
20 views

Is it possible to change multiple values, by different amounts concurrently?

I'm trying to resize and relocate an object, by changing the x, y and area values, all at the same time. I can do them one after another by running 3 separate for loops, but the animation needs to be ...
1
vote
1answer
30 views

Trying to understand example in book “Programming in Lua”

Trying to understand exercise 5.1 in Programming in Lua, fourth edition The code is included, but I don't understand what's going on sunday ="monday" ; monday ="sunday" print("After first line ", ...
1
vote
0answers
18 views

Persistent socket connection in Lua/Python

I'm trying to create a persistent socket connection between a Lua client and Python server. Effectively a script that'll constantly ping the server with keepalive messages My current issue is that ...
0
votes
0answers
16 views

team checking weapon dealer garry's mod darkrp gamemode

I want to make a npc system if some players in this job "weapon dealer" npc can't be used i tried this but didn't work i put this code on lua/entities/npc/init.lua if pl:Team() = TEAM_DEALER > 0 ...
1
vote
1answer
22 views

can you no longer assign require to a variable and reference the variable

im using lua5.1 and im a little confused on how require works i've seen code have require assigned to a variable and use that config = require("config") --outputs a Boolean value --what I've seen in ...
0
votes
1answer
32 views

attempt to index field 'LocalPlayer' (a nil value)

i have been trying to fix this problem in my game: "attempt to index field 'LocalPlayer' (a nil value)" but nothing i tried to do worked here is the code: please do not mind the extremely un-...
0
votes
1answer
35 views

Run LUA in STM32F103 throw an error “unexpected symbol”

I have successfully built LUA in STM32F103, and the code below is OK: const char lua_test[] ="print(\"Hello Lua!!\")"; lua_State *L; L = luaL_newstate(); luaL_openlibs(L); luaopen_base(L); ...
-1
votes
1answer
38 views

attempt to index upvalue 'player' (a nil value)

please help me! I am making a game but i keep running into the same problem i tried many things but nothing worked script.Parent.Humanoid.Died:Connect(function() print("yeet") player....
0
votes
0answers
17 views

Xonix Game Optimization Problems

I'm doing a Xonix game on corona sdk. As a playing field, I decided to use a grid of squares. Width 44, Height 71. As a result, I received a row consisting of 3124(44*71) squares along which the ...
0
votes
0answers
7 views

Fail to load t7 checkpoint with Torch7 + Cuda 10

I'm trying to run a Torch7 model on a new NVIDIA RTX 2080 GPU. Since the GPU needs Cuda 10.1 but the official Torch version does not support Cuda 10, I'm using the unofficialy maintained repo https:/...
0
votes
1answer
50 views

Solving logic game Lights out with A* algorithm

I have some problems solving the logic puzzle called Lights out using the A* algorithm. For now, I'm using an implementation of the A* algorithm where I consider the entire matrix of lights as a node ...
2
votes
1answer
26 views

How to use this LUA table?

I'am new to LUA and I'am using it to create some Envoy Filters. So, I have found a piece of code with a Table like this : MyClass = { [":path"] ="something" } I want to add a contructor to ...
0
votes
1answer
22 views

Building NodeMCU firmware

I am trying to build nodemcu firmware by cloning the github and using the make command, https://github.com/nodemcu/nodemcu-firmware. I'm using a raspberry pi, which could the issue. I am not ...
1
vote
1answer
29 views

Lua: Can I select a table in script via argument in command line?

I have a lua script with many tables like local a = {1,2,3} local b = {1,2,3} local c = {1,2,3} etc. and one function like test = {} function test.set(args) for x, y in pairs(args) do .... ...
1
vote
0answers
38 views

Best way to convert #defines into Lua global variables?

I'm trying to read and detect all #define preprocessors in a C header file (glew.h) so I can convert them to Lua global variables. For example, #define GL_RGB 0x1908 will be detected and run as the ...
1
vote
1answer
29 views

Call an object method from a string

I have a main loop in my lua script, and i am including 2 objects like this: local Menu = require("menu") local InputHandler = require("inputhandler") Here are the scripts for each object: menu.lua ...
1
vote
0answers
25 views

Error running call reference function for resource es_extended fiveM

Basically have another fivem es_extended issue where I am getting unwelcome errors everytime users try and join my server and show their money as undefined, and also not allow them to save their ...
0
votes
1answer
30 views

Assign an only select value, to a only one variable

I'm stating with LUA and SQL statements. I have try, and I can display a SELECT or make an UPDATE, INSERT ... but i don't know how to assign an only returned select value, to a variable mysql = ...
1
vote
0answers
25 views

How to monitor nginx running in a docker swarm with prometheus?

Problem: Monitor Nginx Scenario: I have a Docker swarm with 4 replicas of Nginx. I need some basic metrics such as latency, HTTP status, etc. I checked out knyar/nginx-lua-prometheus. It's working ...
1
vote
0answers
20 views

Getting error Error parsing script /server/main.lua:146: '}' expected (to close '{' at line 139) near '='

Getting error Error parsing script @esx_identity/server/main.lua in resource esx_identity: @esx_identity/server/main.lua:146: '}' expected (to close '{' at line 139) near '=' local lastdigits = ...
1
vote
0answers
18 views

Difference between redis.call('HMGET', key, value) and redis.hmget(key, value)?

Is there any notable difference, particularly from a performance perspective? Or are they effectively the same?
1
vote
0answers
28 views

Error working with Lua modules using LuaBridge and C++

I am unable to include a Lua file in another Lua file. I am compiling Lua using C++ and LuaBridge. Here is my main function. Very very small. lua_State* luaState = luaL_newstate(); ...
1
vote
2answers
36 views

parsing failed because a } isnt put in?

Setting up a fivem server and trying to get esx_policejobs to work after putting in custom job_grades. Have gotten an error and have been stuck for hours, I don't know if I'm missing something here or ...
2
votes
1answer
62 views

Global variables missing after using require in lua

The problem is, a "require" keyword clears all global variables defined in the same file. I am working on a project in c++. I use lua 5.3. The lua scripting style is: 1 all lua codes contains 1 ...
1
vote
1answer
31 views

How to assign global Lua function variables in Lua C API?

I'm trying to rename some functions in Lua so I can call them more easily. For example, of.getHours() function should be able to be called by ofGetHours(). So after initializing the Lua state, I ...
1
vote
1answer
26 views

How to properly print error messages from `luaL_dostring()`?

Here's my code that runs a Lua script as a string. bool doString(const char *s) { const int ret = luaL_dostring(L, s); if (ret) { if (ret == LUA_ERRSYNTAX) printf("...
0
votes
1answer
31 views

Is there a function that executes a script?

So, I'm trying to make a user interface with the clickdetector but I need to run/call another script to continue. Is there a function that does this? local clickdetector = game.Workspace.CPU.Part....
0
votes
1answer
25 views

Get random item from sorted set in Redis

I was needed to implement set of items with individual expiration, so I used zsetwith score of expiration timestamp. Now I want to get random item from range of not expired items, or at least from all ...
1
vote
1answer
37 views

How do I find (and remove) locations in my code that require administrator privileges?

I have a multi-process application that was originally developed in XP and was originally designed with no regard to administrator privileges. We used to configure and sell computers with the ...
1
vote
1answer
69 views

How do I restore/call an original function after it's redefined?

I'm using LuaJIT 2.1 and when I need to hide the source code, I first obfuscate it to prevent the script from being decompiled, and then compile it. We know that we can hook any function in LUA just ...
0
votes
1answer
29 views

Is there a way of manipulating a global variable you use as an argument for a function in lua?

I'm trying to write some code into a function so that it can be easily reused whereby a global value is increased. The issue is that there are several different globals that can be manipulated, and ...
0
votes
0answers
46 views

Nginx Lua: shell script execution security

I want to run some shell script on a specific POST request and pass some request parameters to the script. I can achieve it by using this lua script in the nginx configuration: location /some/path { ...
0
votes
0answers
25 views

Unable to read serial/uart pins on NodeMCU

I am unable to read the serial pins in the NodeMCU Lua environment. I have only been able to read the USB serial port. I have connected a serial adapter to the rx, tx, and g pins. I have tried this ...
1
vote
1answer
51 views

Need help understanding how gsub and tonumber are used to encode lua source code?

I'm new to LUA but figured out that gsub is a global substitution function and tonumber is a converter function. What I don't understand is how the two functions are used together to produce an ...
0
votes
0answers
37 views

I have problem with Luadec, error: bad header in precompiled chunk

I have a problem decompiling a .lua file. I'm using luadec but when I try it say: luadec.exe: file.lua: bad header in precompiled chunk or : not a precompiled chunk I read could be problem of the ...
1
vote
0answers
28 views

Luabridge not working without “luaL_openlibs(L)”

I cannot use luabridge without having the following line: luaL_openlibs(lState); And I don't even use its library functions. I get this error : Assertion failed: lua_istable (L, -1) Just my ...
3
votes
1answer
70 views

Why t[1] output is 1 for local t = {1, [1] = “a”, [2] = “b”}

Test Code: local t = {1, [1] ="a", [2] ="b"} print("t[1]: ", t[1]) for _, v in pairs(t) do print(v) end Output: t[1]: 1 1 b
1
vote
0answers
67 views

How to get a variable name that is created in a for loop

Basically I have a for loop that is creating variables based on data in a database, I then have an event listener that is also created based on the for loop and I want to know which text is pressed ...
0
votes
1answer
23 views

Trig, placing items and updating their position

I have a problem I just cannot solve, and after a week it's really winding me up. Background. I'm placing items onto a circle using basic trig. The number of items can change dynamically, and they ...
0
votes
0answers
11 views

Set TimeOut values within Apache LUA scipt for proxy

I have a hook in a apache reverse configuration written in lua. When i try to set timeout values for keepalive values in this script the have no effect on the connection to the packend system Virtual ...
0
votes
0answers
22 views

Is there an option in Redis like HMGET, where you can retrieve keys and values?

I need to be able to retrieve the values of specified keys like below, but I would like to be able to have the keys returned in the call as well: HMGET myHash key1 key2 key3 returns val1 val2 val3 ...
1
vote
3answers
46 views

lua - split string with whitespaces and numbers by comma

How do I split string with whitespaces and numbers in it by comma? e.g str ="bar, bar123, bar 123, 123" to a table containing {"bar", "bar123", "bar 123", "123"}
0
votes
1answer
17 views

How can I stop nginx failling over when openresty throws runtime error deploying cert

We are using openresty and the lua-resty-auto-ssl package to generate certificates from Lets Encrypt but lately the server keeps falling over. Im guessing its triggered when a certificate trys to auto ...
2
votes
1answer
37 views

Need to declare local functions or variables inside a local table?

In lua if I have local table={} table.variableA=1 -- this is local? local table2= { local variable2=2 -- this is the same that above? } and when I declare functions inside a local table, they ...
0
votes
1answer
28 views

If all the players were killed or resetting during a round, how do you stop the game and display a message for everybody?

I am developing a remastered game, and want to figure how the round will stop if all players were killed or reset, and display a message for all players, "Game over", and returns back to the lobby ...
1
vote
2answers
32 views

Filtering Multi Array Table

Let say I have 2 combo boxes. First combo box for a category and another one is for units. I made the array table like this: Table1 = { Cat ='Angle', Unit = {'Degree','Gradian','Radian'}} ...
0
votes
0answers
15 views

Changing username/password on a reverse-proxy NGINX server

I'm attempting to implement an NGINX reverse-proxy server that accepts HTTPS commands from a client application and relays them to a downstream server, again using HTTPS. The user/password used by ...
0
votes
1answer
46 views

If then depending on change in value in lua

I'm trying to read out 5 microswitches and calculate how many are active and which ones. In this, I've succeeded. However, I'd also like to know how many are taken while a door is opened (doorstatus ==...

http://mssss.yulina-kosm.ru