typedlua
typedlua copied to clipboard
insert dynamic type checking code
I'd like to use typedlua to compile code for use in regular, dynamically typed Lua applications. That is, most of the code that will be using my code as a library is likely going to be not statically typed.
For that, I'd find it useful if there was an option to have typedlua insert type checking code at the boundary between dynamic Lua code and typedlua code.
Concretely, I'd find it useful if "typedlua -t example.lua" would transform something like this:
function f(x: string): string
return x..x
end
into
f = function (x)
if type(x) ~= "string" then error("function f, argument x:string, got "..type(x)) end
return x .. x
end