I don't understand the term 'pointer' but this doesn't seem all that complex a problem. The one thing missing is that (I am told) Lua doesn't seem to support recursive expansion of variables. The way around this being to stick your various target variables into a table.
Code: Select all
tars={
otar="",
itar="",
dtar=""
}
function retarget(target, given)
if given ~= nil then
tars[target] = given
end
return tars[target]
end
Edit
I am not in a position to test that, but I -hope- that by switching the function parameters like that, this function will still work even when matches[3] in the alias is nil . At least, the function will work, but I am not sure if the alias itself will work.
If the alias refuses to call the function with a nil second parameter, then the problem is more complex. Well, even then the solution is simple enough, but it is not a solution I like - it involves putting more script in the alias itself, and in my opinion part of the point here is to make these aliases simpler to write as well as to use.