22,896 questions
0
votes
0
answers
33
views
Proportionally scale an array of numbers so the total equals a specific number [closed]
I currently have an array of randomly generated numbers ranging between 0.5 and 1:
local ArrayOfRandomlyGeneratedNumbers = {
[1] = 0.56756654;
[2] = 0.56756767;
[3] = 0.76576576;
[4] = ...
0
votes
1
answer
14
views
Adding variable length int/float/string array fields to subtree in lua dissector
I'm in the process to implement a WireShark dissector, and I have a technical question (I'm still learning the details of a lua dissector).
In particular I want to add int/float/string items to the ...
1
vote
0
answers
20
views
Can I copy the vim api in neovim
I want to make a neovim plugin but my plugin need to be able to copy the whole vim api, do some changes to it and roll back later
backup = vim
-- do some stuff with `vim`
vim = backup
I tried to do ...
2
votes
1
answer
24
views
How to precompile and dump Lua binary with C closures?
Currently I have a Lua-driven system with C functions connected. When it is built from source, it is constructed as below:
// bind C functions to make them callable inside Lua code
...
1
vote
1
answer
46
views
Setting up denols to work along with tsls in kickstart neovim
I want to set up language server for my JS/TS project with Deno. I am using modular_kickstart which is a fork of kickstart neovim. I have put my config for deno in my lspconfig.nvim plugin file like ...
1
vote
1
answer
27
views
Any way to combine two tables in lua?
Like I got two tables:
{["a"] = "aaa"} and {["b"] = "bbb"}
And make it into one table: {["a"] = "aaa", ["b"] = "bbb"}
I ...
1
vote
0
answers
18
views
Index lua table with table [duplicate]
if I have an x and y I want the following to print 6(without making a string or combining the numbers into one):
a = {}
a[{1, 2}] = 6
print(a[{1, 2}]) -- nil
unfortunately lua uses the address of the ...
1
vote
1
answer
24
views
Lua os.getenv("UID") returns `nil` but environment variable it's already set
I'm writing a yazi plugin to preview documents. I'm on GNU/Linux. I'm trying to save the temporary files in a dedicated folder with the UID —user id— as suffix.
According to Programming in Lua
The os....
0
votes
0
answers
54
views
+500
How to make a payload in Edge TX and send it with ELRS telemetry package to flight controller (Betaflight, MSP)?
I want to practice Lua writing EdgeTX scripts for FPV drone telemetry. I have found a pretty decent documentation for edge tx and Lua. In order to accomplish my task I need to establish a ...
1
vote
1
answer
40
views
Pass NestedStruct from c++ to lua
I'm trying to make a c++ function address mapping with lua, so that I can do hot fix,but I can correctly pass nested struct to lua (I guess, because I print table before call lua function), but I got ...
0
votes
0
answers
9
views
os.remove works but Shell:Run with luacom doesn't
I have a file at c:\test.mp3. Removing it with os.remove("c:\\test.mp3") works but I want to remove it with del command from luacom's Shell. Unfortunately, it doesn't work:
local command = ...
-3
votes
0
answers
27
views
Making a newspaper in computercraft, any way to deconstruct the http return? [closed]
https://newsapi.org/docs/endpoints/top-headlines
If it helps, I just need the title (and, preferably, in the same order as they came in)
The code:
local printer = peripheral.find("printer")
...
1
vote
1
answer
26
views
JavaScript's proxy.apply handler in Lua
In JavaScript, you can make an object that is callable like this:
const prox = new Proxy(function() {}, {
get(target, key) { return true }
apply(target, that, argList) { console.log('This came ...
0
votes
0
answers
18
views
How to connect Lua module with Simion workbench program
Hi,
I am a new user of Simion and Lua, so probably my question is rather silly, but I will be very grateful for the answer though)
I would like to realize some useful Simion functions as separate Lua ...
0
votes
1
answer
15
views
Initialize lua dissector ProtoField table inside protocol init function
I would like to initialize the fields protocol table inside the protocol init function, is it possible ?
I've tried the following but it doesn't seem to be working:
function my_protocol_addProtoFieds()...