One of the tutorials in metalua manual proposes pretty much this. I've just realized that it somehow "disappeared" from the manual, but an older version is here:
, and up-to-date sources are here:
Since global code manipulation is more practical in metalua, it allows more stuff: it also checks returned types, it checks every re-assignment to a typed variable, and the type grammar is quite rich.
I'm also occasionally working on static type inference for (some dialect of) Lua, but it's a much more more complex and theoretical issue. However, I'll finish metalua 0.4 before going seriously back to this, and anyway, it'll be more interesting for lambda-loving theoreticians than hackers.