Page 1 of 1

[0.12.5] Lua TransportLine get_contents()

Posted: Sat Aug 29, 2015 9:09 am
by Kikkers
This scripting function doesn't seem to populate the table it returns.

Reproducable by filling a belt, calling get_contents() on one of the belt's lines, and printing the # of the returned table.

Re: [0.12.5] Lua TransportLine get_contents()

Posted: Sat Aug 29, 2015 6:51 pm
by Rseding91
#table doesn't work that way for named indexes:
Image

You have to check for the key and then if it isn't nil check the count it returns.

See: http://www.lua.org/manual/5.2/manual.html#3.4.6

Re: [0.12.5] Lua TransportLine get_contents()

Posted: Mon Aug 31, 2015 7:57 pm
by Kikkers
What a language, what a wonderful language.

You're completely right, but still, I was sure i did check whether looping worked. Apparently not.