Fixed typo in type()
Moved tonumber() code in  separate function lua_tonumber()