Nexarius Posted August 20, 2017 Posted August 20, 2017 Hello, Does anyone know why table.concat is not giving back anything here? Thanks for the help Quote
1 Fingercomp Posted August 20, 2017 Posted August 20, 2017 When table.concat is called without specifying the fourth argument it's assumed to be #list. The default value for the third argument is 1. Operator # returns any of the table's borders. A border is a natural index of a non-nil element that is followed by a nil element. There's only one border in sequences. In table {1, 1, 2, 3, 5, 8}, the border is 6. Your table is different, as it has more than one border: 0 and 2. The border the operator # chooses depends on the Lua table implementation -- it could be 0 as well as 2 depending on how the table was populated and its non-numeric key elements' memory addresses. In your case, the implementation has chosen 0. So you have implicitly called table.concat(a, "", 1, 0) and because the end index was less than the starting index, table.concat returned an empty string, which was then printed to the console. More info: https://www.lua.org/manual/5.3/manual.html#pdf-table.concat https://www.lua.org/manual/5.3/manual.html#3.4.7 Quote
Hello,
Does anyone know why table.concat is not giving back anything here?
Thanks for the help