This is where active bugs can be seen and where to post a new bug.

Arrays within arrays issue

Arrays within arrays issue

Postby epsilonion » 27 Oct 2017, 13:11

following the example in the api using the following shows up errors
people =
{
{"Tim",21} --name = people[1][1] and age = people[1][2]
{"John",35} --name = people[2][1] and age = people[2][2]
{"Miller",40} --name = people[3][1] and age = people[3][2]
}

basically it wants you to close the table so you just have people = {}

I did post in discord but remembered about your issue with the internet
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: Arrays within arrays issue

Postby SolarPortal » 27 Oct 2017, 14:19

yeah, thats lua, unfortunately...

we create a table with

Code: Select all
table={}


then:
Code: Select all
table[1] = {}

etc...

i also think for your table design, you would have to(it might work):
Code: Select all
people = {
    [1]={Tim=21,[100]=true}
    [2]={John=35}   
    [3]={Miller=40}   
}

then access with people[1]["Tim"] which would then print 21(edited)
also, lua does not like starting at 0 with tables

Check out: http://lua-users.org/wiki/TablesTutorial - Section: Tables as arrays
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to Active / New Bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron