Wouldn't it be better to just generate the functions and set them as the tag handler? That way you don't hit the problem with loadstring and scope. It would most likely be faster also, as you don't have to regenerate the tag function every time the tag runs. The Lua compiler is fast, but relying on that seems like a bad solution.
|