It is currently August 11th, 2020, 6:24 pm

two dimensional array in lua script

Discuss the use of Lua in Script measures.
epvhgjy0418
Posts: 5
Joined: March 12th, 2019, 3:11 am

two dimensional array in lua script

Post by epvhgjy0418 »

Hello. I am using a Lua script (see below) to parse a web site collected by WebParser. Part of that web site source is provided as variable CoronaDataState[1]. I then parse the data to get the values for

Code: Select all

Dates[h][i]
(this example only uses one h-value; the complete code uses more). The values for

Code: Select all

Dates[h][i]
are printed correctly from within the while loop but not from outside that loop. I am sure the problem is something simple but my very limited knowledge of Lua prevents me from understanding the problem. I hope you can help.

Lua script:
Dates.txt
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 21240
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: two dimensional array in lua script

Post by jsmorley »

You might want to read through this:

https://www.tutorialspoint.com/lua/lua_arrays.htm
epvhgjy0418
Posts: 5
Joined: March 12th, 2019, 3:11 am

Re: two dimensional array in lua script

Post by epvhgjy0418 »

Thanks jsmorley. I have in fact looked through that and many others. To be sure, if I use the Multi-Dimensional Array script on that page, it works fine (I actually modeled mine from that). Somehow, I cannot see the essential difference between that script and mine. There must be something I am missing.
epvhgjy0418
Posts: 5
Joined: March 12th, 2019, 3:11 am

Re: two dimensional array in lua script

Post by epvhgjy0418 »

Well, thanks again jsmorley. After re-thinking the code and rearranging one line, I discovered the solution. I appreciate you forcing me to think about the problem. Best wishes.
User avatar
jsmorley
Developer
Posts: 21240
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: two dimensional array in lua script

Post by jsmorley »

epvhgjy0418 wrote: June 20th, 2020, 10:07 pm Well, thanks again jsmorley. After re-thinking the code and rearranging one line, I discovered the solution. I appreciate you forcing me to think about the problem. Best wishes.
Oh, GREAT!

And I was just getting ready to take a look at it... ;-)

Just kidding, I'm kinda tied up today, and probably wouldn't have been able to get to it til tomorrow. Glad you got it working!