function templates.text(text)
return string.dump(function()
love.graphics.printf(text,40,40,400)
end)
end
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 .
Last edited by rok on Tue Jun 30, 2015 9:32 am, edited 1 time in total.
yes, whenever possible you should return functions instead of dumping/loading them
for informational purposes: in lua 5.2/5.3 or luajit, it is in fact possible to "fix" upvalue bindings of loaded functions via debug.upvalueid and debug.upvaluejoin, but obviously you should only be doing things like that if you absolutely cannot avoid dumping/loading the function (such as trying to send a function between love threads, since iirc you can't send function objects)