Code to Convert a Table to a List (for lack of better terms)
So here is my situation for my addon. Here is a function very similar to one I have:
Code:
function testFunction(parent, index, ...) Code:
local i = object:testFunction(index, param1, param2, param3) Code:
local paramTable = {index, param1, ...} Is there any better way of doing this than to just get the length of the table and then have an if statement for every number of parameters like this?: Code:
function testFunction(pTable) Thanks |
local a,b,c,d = unpack(pTable)
tableOfFunction[b](a,c,d) also you can unpack at the point when you call testFunction testFunction(unpack(pTable)) |
unpack is just what i was looking for!
I actually ended up working around having to do it but learning new lua functions is never a bad thing :) Thanks |
All times are GMT -6. The time now is 12:53 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI