All Questions
343
questions
0
votes
1
answer
27
views
Lua Script for Reading CSV Produces Incorrect Output Format on Last Line
Issue Description
I am writing a Lua script to read a CSV file and parse each line into a table. While processing the CSV file, I noticed that the output format of the last line is incorrect.
Here is ...
2
votes
1
answer
75
views
How can I convert a String that is formatted like a table, into a table?
I did find a version of this for a string into a table that splits up the letters of the string, but I have a table, that I turn into a string to remove the first part of it, and now I want it back as ...
0
votes
0
answers
47
views
Lua get array size in object
I am attempting to make a loop that goes though each item in an array.
However, that array is in an object and the loop will only run though the first item, This is due to loop seeing the inserted ...
2
votes
3
answers
72
views
Lua | String Pattern Replacement
local str = {
["red"] = "ff0000",
["blue"] = "4C9FFF",
["purple"] = "C33AFF",
["green"] = "53FF4A",
[...
0
votes
2
answers
46
views
Is there a way to execute command from array with "for do"?
New to lua.
On example i have multiple
local part1 = display.newImage("part1.png", 0, 0)
part1:scale ( 0.5, 0.5)
part1.isVisible = false
...
local part10 = display.newImage("part10.png&...
0
votes
0
answers
65
views
Lua reading table as array in C returns nil for indices
I want to share a lua table given as an argument for a registered C function and convert this table to an C array.
Lua 5.4.
The table length is correctly retrieved, however the indices type are always ...
0
votes
1
answer
87
views
How to read/iterate Array of ojects in lua script
I am writing lua file. In that we have to read Array of objects to the requested body. Below is the sample request body json.
{
"year":"2023",
"languageId":"2"...
1
vote
1
answer
90
views
How to concatenate matrices in lua with wrapping
im not sure if the title is the correct question, i have very little programming knowledge but i know exactly what i want to accomplish, not how to ask what to do, so ill just give an example.
mX = {
{...
2
votes
1
answer
218
views
Flattening nested lists in Lua
Suppose I have a list that looks like this:
{{'text'}, {'something', 'string'}, {'thing'}}
I want to turn this into the following list:
{'text', 'something', 'string', 'thing'}
"flattening"...
1
vote
1
answer
233
views
Convert Lua array to C array when C function takes multiple inputs
I'm trying to figure out the interaction between Lua and C where a C function takes multiple inputs, one being a Lua array. Other articles on StackOverflow cover only an array being passed in to C, ...
1
vote
1
answer
42
views
Generating tables with unique addresses
I am attempting to insert a series of tables that have values generated by a function. I have noticed that the generated tables all have the same address and thusly only the most recently generated ...
0
votes
1
answer
47
views
Initialize Lua array in a function and use it outside. I do not get it
playerInjuries = {}
function OnPlayerTakeDamage(ply, dmginfo)
if ply:IsPlayer() and dmginfo:IsDamageType(DMG_BULLET) then
local hitgroup = ply:LastHitGroup()
local ...
-2
votes
1
answer
313
views
Lua switch like statement with case fallthroughs, accessible via C api
Trying to build a table that looks up effects depending on integer results.
Some of the results are in a range, like 1 to 5, but ultimately there's a bunch of em.
http://lua-users.org/wiki/...
0
votes
1
answer
340
views
attempt to call method 'draw_self' (a nil value) error - when trying to call function of a table within an array
I just started learning Lua and LOVE2D, I'm trying to make text input boxes, I've got 4 instances within an array and I'm trying to call their draw function within the love.draw()
TextBox = {
x = ...
0
votes
1
answer
113
views
How do I pass variables and tables through functions on Lua?
I'm trying to simplify my code by putting everything through functions, but I don't think that the variables and tables are passing through the arguments in my code, or nodeNumber isn't working ...