Otherway to have changing args on function than using table?
Posted: Fri Aug 18, 2017 10:06 pm
Here is what is not untypical to happen in my programs:
What I would rather have is:
But i guess this isnt really possible to do this way?
Code: Select all
function myfunc(xy_table)
x=nil
y=nil
if haveitem(xy_table, "x") then x = xy_table.x
if haveitem(xy_table, "y") then y = xy_table.y
endfunction
temptable = {x = 100}
myfunc(temptable)
Code: Select all
function myfunc(x, y)
if x is there
x = x
else
x = nil
endif
if y is there
y = y
else
y = nil
endif
endfunction
myfunc(y)