22,955 questions
1
vote
1
answer
45
views
Why does my lua table randomly lose values when iterating?
i'm writing a small utility for a roblox game. it's just server-side lua, not executor stuff. i'm filtering a list of values before using them for spawn logic. i'm trying to remove numbers lower than ...
0
votes
1
answer
44
views
Cylinder created through Raycast does not face the meant direction
I've got this string of code in a global script fired from a local script which creates a straight line from the origin of the Raycast to the ending of it, essentialy tracing its trajectory accurately:...
1
vote
1
answer
52
views
How does Neovim populate the runtimepath at launch?
I am trying to upgrade from Neovim version 0.10.0 to 0.12.0. However, the runtimepath is still configured for version 0.10.0. When I run lua print(vim.inspect(vim.api.nvim_list_runtime_paths())) the ...
4
votes
2
answers
85
views
What is the significance of making a nested function global in Lua?
This is the Lua version of Knuth's "Man/Boy Test". I found that, to reproduce the result shown in the Wikipedia article, I had to declare the nested function "B" "local"....
0
votes
1
answer
73
views
overriding conform.nvim via nvim-config-local to stop autoformatting certain files
I have forked kickstart.nvim and cloned it to my machine while also adding nvim-config-local to the require('lazy').setup(...) section of ~/.config/nvim/init.lua. Now I would like to put a .nvim.lua ...
0
votes
1
answer
104
views
Luau --!strict: "Unknown type 'DataServiceServer'" when returning typed table
I’m working in Roblox using Luau with --!strict enabled.
This is a ModuleScript intended to return a typed table.
It runs on both client and server.
Here is the minimal code that causes the issue:
--!...
Advice
1
vote
1
replies
87
views
I would like some advice on ways I can make this code better
I also want to know if it would even work. Im trying to make a function that whenever it runs it selects a cheese from the list and then gives it mutations. It should be able to give as many mutations ...
1
vote
1
answer
69
views
xml2lua gives me multiple root nodes
I'm trying to parse an arbitrary numbers of XML documents for a Neovim plugin with xml2lua (I use a specially packed version but I can reproduce this issue with the package from luarocks too). The ...
1
vote
1
answer
64
views
Function return value changing when being used on variable assignment
I've been messing with LÖVE2D framework for a project, and while I was designing a scene manager, I came up to this issue which I couldn't find information about, nor I could troubleshoot.
I have a ...
0
votes
1
answer
170
views
How to spawn specific enemies and add ammo in quantity with REFramework and Lua Resident evil 4 remake
I'm building a Discord bot that controls RE4 Remake in real time via REFramework Lua scripts justo for fun for my friends and me. I have some things working but I'm stuck on two specific things.
What ...
1
vote
1
answer
100
views
How do I manage classes in such a way, that I can create as many objects from a class as I need, and not cause a data leak?
I have been working on a project for a while, and have recently ran into an issue where, while trying to load a "chart" for a game 5 I am working on, the game will stop responding and eat ...
Advice
2
votes
1
replies
78
views
How to convert integer to booleans representing binary digits?
Apologies if this is a dumb question, I'm new to both stack exchange and programming in general.
Anyway, here's the problem I'm facing: I'm writing a function for a lua program, and I need to convert ...
Best practices
0
votes
2
replies
39
views
Lua learning for fxcm
I want to learn, writng code in lua for fxcm(marketscope) so im looking for a resource to learn it step by step.
I have a strategy that takes too long, manually so im intended to turn it to the code ...
Best practices
1
vote
8
replies
147
views
When is it appropriate to use the "Async" suffix when naming a function? Yield, or non-blocking, or both?
Let's say I named a function DoSomethingAsync.
Now, without running it. Do you think it yields, or runs immediately, but returns something later, and allows the caller to continue running more stuff ...
7
votes
1
answer
118
views
Why is a recursive Lua function calling itself via a local alias instead of directly?
Below code is from nmap tableaux.lua script file which is located at /usr/share/nmap/nselib
local tcopy_local
function tcopy(t)
local tc = {}
for k, v in pairs(t) do
if type(v) == "table&...