Noob question sub set of a table

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Noob question sub set of a table

Hello all,

I would like to know how to create a table from a different table, using an index and length: something like:
I tried searching for it and fond nothing, just copy function, but that is not enough in my case.

function subTable(_oldTable, _fromIndex, _length)
-- some code...

and use it like

local ot = {1,55,77,88,99,232,1,31,2}
local st = subTable(ot, 2, 4);

and the result will be st = {77, 88,99, 232}

it's probably very easy and basic (even stupid   )  , but, hey! anyone has any idae?