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

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

Trying to override a class function but it doesnt and uses the default function it inherits from

I am trying to create custom move functions for my enemies but when I try to override the move function so it uses the new custom move function it doesnt and instead uses the original move function ...
  • 177
0 votes
1 answer
23 views

Can anyone explain what's wrong with this code? It is in lua

The error for this code is "lua: main.lua:9: attempt to compare string with number stack traceback:" Here is the code it is meant to be a guessing game in Lua: print("guessing game"...
  • 1
1 vote
1 answer
23 views

Loading Luau script files with the C API

I want to let a third-party develop a Lua script that runs with my C++ application. A script may contain many individual files. To make this safe I use Luau for sandboxing. My C++ application must ...
  • 51
0 votes
1 answer
11 views

Code causes lag spike for 1-2 seconds - Roblox Studio

I'm trying to make a Roblox Doors fan-game and everytime I open a door, it spawns a new room. I dont want to spawn all the rooms at once because that lags out mobile. Is there any way of me fixing ...
  • 37
0 votes
0 answers
6 views

Discord gateway disconnecting frequently

so i'm making a discord-fivem api wrapper. But i'm standing at a problem, and don't know what the problem is... It keeps disconnecting, and then i reconnect - but i't just doesnt feel right... Is this ...
  • 1
1 vote
1 answer
20 views

How does lua know that the __index function's second parameter is the key?

I find that lua'a object orient system and metatable very confusing, it makes simple class and instance grammar more complex than that of the C++. I was looking at this code (for this example https://...
0 votes
1 answer
14 views

How can I tell if a string starts with an emoji or not in Lua 5.2?

I know trying to deal with emojis in a string can get complicated in some cases, but in case I only wanted to know if a string starts with an emoji (any) or not, is there an easy way? Sorry if it ...
  • 146
-2 votes
0 answers
43 views

When using the print function in Lua to output numbers, only 'ld' appears without the actual numbers [closed]

I'm trying to port the lua interpreter(lua 5.3.5) to a microcontroller, which uses a 32-bit cpu. I am using the gcc compiler, which is targeting riscv-none-embed. The compile flag is -march=rv32imacxw ...
  • 1
0 votes
0 answers
8 views

Why isn't this Roblox script running/working after round reset?

I'm still fairly new to Roblox/Lua, so you're dealing with a noob here who's only prior experience is in web dev. My game has a typical 'round-then-intermission-then repeat' loop. Everything works ...
1 vote
1 answer
17 views

Lua inheritance example creates singular instance

Let's try out the inheritance example from the official lua docs and declare everything this way: Account = { balance = 50, receipt = function(self) print(self.balance) end, new = ...
  • 1,852
0 votes
1 answer
39 views

How to properly source/use lua file in `init.vim` config for neovim?

I am new to neovim and I discovered that configs can be written in lua. I have been using init.vim(located at ~/.config/nvim/init.vim), but I wanted to start writing new configs in lua. What is the ...
0 votes
1 answer
23 views

Need help in converting the python command into lua

I need help in converting the below python commands which are basically extracting the CRC of a file(*.LUH or *.bin) file into Lua commands. filename_expected = os.path.abspath(header_path) Read and ...
0 votes
1 answer
21 views

How to execute shell script from premake5.lua

I am trying to add a prebuild task in the premake5.lua file. Basically I want to change directory and execute a shell script. I searched and apparently I can use the function "prebuildcommands { &...
  • 165
0 votes
0 answers
15 views

Lua - Filter Forge - Simplex Noise: Need help troubleshooting 'attempt to index a nil value (local 'grd')'

I'll get the ball rolling with this: I converted Simplex noise written in java to lua and found myself caught on a potential out of bounds error being reported as an attempt to index a nil value. I've ...
0 votes
2 answers
32 views

Something locking change camera

I am trying to make the player change from "LockFirstPerson" to "Classic", but it isn't working. The fuction works and I used print("Tried to enable classic") which did ...
  • 1
1 vote
1 answer
23 views

Lua exact match line from file

So here is my scenario : I have nginx-lua config, that it contains json data (from POST request) : { "profile_name": "test", "number_from_json": "12", } ...
  • 25
1 vote
1 answer
15 views

How to make a food item in Minetest do multiple actions? [Minetest][Modding]

I'm making mods for the game MineClone2 (a downloadable game for Minetest) Currently, I am trying to make a food item that will boost speed as well as add be eaten. My issue is that if I use this code ...
0 votes
1 answer
29 views

Does returning a pre-created table create a new one?

If I run this piece of code MyTable = {} function SomeFunction() return MyTable end SomeFunction() Does it create a new table or return a pre-created table? So far, I don't know exactly how I can ...
  • 3
0 votes
1 answer
38 views

Count Boolean Values in Lua [closed]

i want to count the boolean values if the boolean conditions is true, the realtime data i assigned to price variable. i have tried following code: price_up = prev_price < curr_price price_down = ...
-1 votes
1 answer
30 views

Im trying to make a roblox game where you gain jump power each jump, and im having some errors [closed]

the error i received when code entered [my code] (https://i.stack.imgur.com/OKOzW.png)
0 votes
0 answers
33 views

How do I make an pathfinding algorythm in lua / Roblox

I know they already have one , but I want one that works in a grid. I would probably go with A*? I haven't seen any 3d examples. How would the nodes be set up , should I mark their neighbors or can ...
  • 1
0 votes
1 answer
13 views

Remap to replace placeholder mark works only if cursor appears before the mark but not when it appears after the mark

I have the following remap in lua: vim.keymap.set('n', '<leader><leader>', ":/<++><CR>ca>") I want this remap to jump to the next <++> and remove it and put ...
  • 1,147
0 votes
0 answers
28 views

Is it possible to write a Lua parser that only cares about function definitions?

I am building a set of haxe externs (AKA bindings) for Neovim APIs. However, the number of methods is huge and I am using some metaprogramming techniques to do it automatically. I just reached the ...
  • 5,341
0 votes
0 answers
14 views

how to get autocompletion with lua codebase in neovim?

I'm using lsp-zero to get most of the functionality I wanted without too much fiddling, and it's working fine so far for most languages including rust and ts. But I can't seem to get any auto ...
  • 36
0 votes
0 answers
5 views

discordia message.content is a nil value

im making a bot in lua using discordia but the print(message.content) returns a nil value or blank space `local discordia = require('discordia') local client = discordia.Client() client:on('ready', ...
0 votes
1 answer
18 views

I have an angle that changes based on player input using lerp, but it doesnt lerp when the target is zero

This few lines of code apply 25 degrees to the players rotation by using the x_value it either gives 1,0 or -1, it works fine if I am pressing left or right but when I let go the player.target_value ...
  • 177
0 votes
1 answer
17 views

screen gui not showing up

im new to lua and im trying to make a roblox admin panel, but it wont work and i cant tell why admins = require(script.Parent.Admins) AdminPanel = game:FindFirstChild("ServerStorage")....
-1 votes
0 answers
20 views

I would be very happy if someone corrected my code [closed]

if script.Parent.first.Value == true and script.Parent.second.Value == true then plr.PlayerGui.PLAY.promt.p1.l1_2.Visible = true plr.PlayerGui.PLAY.promt.p1.l1_2.let1_2script.Disabled = false ...
  • 1
0 votes
0 answers
10 views

Wait Value = numbervalue that i named Speed (i am doing this in Roblox Studio)

So i am making scripts and right now i am making duplicate scripts with different wait times Just to make different speeds. (What i need to know) So to do wait it is wait() and you put values in the ()...
0 votes
0 answers
22 views

How to indicate end of STOR ftp

I'm programming a FTP client with Lua, and due to some limitations, I can only use sockets to connect to the FTP server (I can't use any specific library). When the file is fully sent, my program ...
0 votes
0 answers
7 views

How do I get a script to find the player who activated a proximity prompt so I can use it to fire a remote event on that player?

I have a proximity prompt on a part, so when you hold e it's supposed to make you're screen fade and teleport you, but I'm not sure why it's not fading the screen. Is it not finding the player? This ...
-1 votes
1 answer
24 views

Lua: moving table values into a sub table

I have a table that looks like { a = 1, b = 2, c = 3, } And I'd like to move this table, while retaining all its values, into a sub-table within the existing table, so it looks like: { ...
  • 93
1 vote
0 answers
32 views

CAN on ESP32 with Nodemcu

I have tried various Nodemcu builds based on the idf 4 (including the online builder) and cannot get the CAN bus to work on the built-in CAN controller. When I do make menuconfig, I don't see ...
-2 votes
0 answers
25 views

Lua reading global variable from external file

I want to run two lua file separately, and at the same time make it possible for one of them to read the global variable of the other. Is it possible ?
  • 45
-1 votes
0 answers
12 views

Dota2 mod error: "attempt to index a nil value" when using CreateHTTPRequestScriptVM in addon lua script

I am trying to run an addon in my Dota 2 mod and do an api call so I used CreateHTTPRequestScriptVM to generate a request but when I run the game it always shows error attempt to index a nil value. My ...
  • 1,501
0 votes
0 answers
12 views

Attempted to index nil with `.Move` on `:GetMouse()`

My (Server) script returns the error: Workspace.MachineGun.Server:11: attempt to index nil with 'Move' - Server - Server:11 and Move should be a non nil child of :GetMouse(). Right? local function ...
  • 1
0 votes
0 answers
5 views

How to setup lua in Xampp?

I use xampp on Windows 10, for home programming, what not. I want to learn, play with lua on that. But i can't get it to execute, any good tutorials? Thanks
  • 1,817
0 votes
0 answers
25 views

How can you include referenced libraries in neovim lsp using jdtls?

I have a java library in a folder in my home folder (on linux) and I've been trying to edit my neovim config to let it be available for any java project. I'm having trouble finding the exact config I ...
2 votes
1 answer
47 views

How do you access the activelines table for nested functions (Lua 5.1)?

I want to be able to read a file, and return a list of all the lines of real code (not comments or whitespace), using the debugger's activelines table. However, it seems like if you have nested ...
  • 21
1 vote
1 answer
73 views

How to include/configure lua_ls on lspconfig?

I am trying to include lua_ls on my lspconfig but I am getting this error [lspconfig] Cannot access configuration for lua_ls. Ensure this server is listed in `server_configurations.md` or added as a ...
  • 1,397
-4 votes
0 answers
20 views

How to Decrypt LuaT Zcus [closed]

how to decrypt LuaT? can u help me decrypt this script? script
  • 1
-1 votes
0 answers
32 views

"attempt to compare number with nil"

I’m asking for your expertise because I can’t find the solution to my problem. My problem is in the title, it is the error code that I have in return when I try running the program. The lines ...
0 votes
1 answer
74 views

What's the proper way of terminating a Lua script / thread in Rust

I am using mlua and Rust to build a scripting engine and a script will only be run one at a time. I was thinking the best approach would be to spawn a thread to run each script. The thread will not be ...
  • 33
-1 votes
1 answer
37 views

Lua NGINX How to get only one value from json POST body

Hello I have lua nginx and I'm having request body My POST body is this : { "param1": "1033893", "param2": "337483", "param3": "test&...
  • 25
0 votes
0 answers
22 views

Roblox Lua How to Prevent user input

I want to prevent the user from being able to input on their keyboard. Specifically, when the user dies and up until they respawn I dont want them to be able to use the mouse or keyboard. When they ...
-2 votes
0 answers
14 views

Is it possible to write a Haproxy Lua module that accepts HTTP requests and feed them into TCP backend?

I read through Lua documentation on Haproxy site and played around with example, but stuck trying to find Haproxy API features I need. Consider the following pipeline that I'm going to build with ...
0 votes
1 answer
19 views

Lua script for creating a folder according to artist metatag with mpv player on windows

I watn to make mpv player like itunes library which organizes media library according to the tags of the file. For start I want to make script for mpv player that creates a folder according to artist ...
0 votes
0 answers
10 views

how do i use async>httpGet(port,url

in im rather new to lua so thats why i ask these question how do i make a toggle to press where if i press it it only regesters the press for one tick but not for everything the button is ouputing to ...
0 votes
0 answers
18 views

Animation script not working on Player in Roblox studio

I tried making a crouch animation that plays when you press left ctrl on the keyboard. I was expecting it to work, but it doesn't.The animation is for the player. And yes, it is an r15 animation. Any ...
0 votes
2 answers
48 views

Lua NGINX String find multi lines

i'm having lua program that i'm reading some files but they are in .csv format, which I need to find some string. When it's having multi-lines doesn't work, only first line is available. Using : ...
  • 25

1
2 3 4 5
433