[SOLVED]Anonymous Function Scope
Posted: Tue Jun 30, 2015 7:21 am
Yesterday a guy on IRC explained to me why this works
but this doesn't
because of the anonymous function scope.
Is there a way to do it without that stupid temporary variable? It even can not be local so that is another problem (overwriting data). There must be a way .
Code: Select all
function templates.text(text)
tmp = text
return string.dump(function()
love.graphics.printf(tmp,40,40,400)
end)
end
Code: Select all
function templates.text(text)
return string.dump(function()
love.graphics.printf(text,40,40,400)
end)
end
Is there a way to do it without that stupid temporary variable? It even can not be local so that is another problem (overwriting data). There must be a way .