Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
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 ...
Weijia Liu's user avatar
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 ...
Asher Roland's user avatar
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 ...
Marxiplier's user avatar
2 votes
3 answers
72 views

Lua | String Pattern Replacement

local str = { ["red"] = "ff0000", ["blue"] = "4C9FFF", ["purple"] = "C33AFF", ["green"] = "53FF4A", [...
Mersad's user avatar
  • 27
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&...
Night's user avatar
  • 1
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 ...
ddomnik's user avatar
  • 63
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"...
Chandu's user avatar
  • 1
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 = { {...
DistantTide's user avatar
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"...
kornelbut's user avatar
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, ...
user2205930's user avatar
  • 1,076
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 ...
niju's user avatar
  • 15
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 ...
Deadshot's user avatar
-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/...
DrDreadful's user avatar
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 = ...
Capnsockless's user avatar
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 ...
James Hood's user avatar

15 30 50 per page
1
2 3 4 5
23