diff options
| -rw-r--r-- | compat53/module.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/compat53/module.lua b/compat53/module.lua index 90b2f06..d514413 100644 --- a/compat53/module.lua +++ b/compat53/module.lua | |||
| @@ -848,7 +848,7 @@ if lua_version < "5.3" then | |||
| 848 | end | 848 | end |
| 849 | 849 | ||
| 850 | function M.io.open(...) | 850 | function M.io.open(...) |
| 851 | local fd, err = io_open(...) | 851 | local fd, err, code = io_open(...) |
| 852 | if fd and debug_setmetatable then | 852 | if fd and debug_setmetatable then |
| 853 | if not compat_file_meta_loaded then | 853 | if not compat_file_meta_loaded then |
| 854 | local file_meta = gmt(fd) | 854 | local file_meta = gmt(fd) |
| @@ -857,11 +857,15 @@ if lua_version < "5.3" then | |||
| 857 | debug_setmetatable(fd, compat_file_meta) | 857 | debug_setmetatable(fd, compat_file_meta) |
| 858 | end | 858 | end |
| 859 | 859 | ||
| 860 | return fd, err | 860 | if fd then |
| 861 | return fd | ||
| 862 | else | ||
| 863 | return fd, err, code | ||
| 864 | end | ||
| 861 | end | 865 | end |
| 862 | 866 | ||
| 863 | function M.io.popen(...) | 867 | function M.io.popen(...) |
| 864 | local fd, err = io_popen(...) | 868 | local fd, err, code = io_popen(...) |
| 865 | if fd and debug_setmetatable then | 869 | if fd and debug_setmetatable then |
| 866 | if not compat_file_meta_loaded then | 870 | if not compat_file_meta_loaded then |
| 867 | local file_meta = gmt(fd) | 871 | local file_meta = gmt(fd) |
| @@ -870,11 +874,15 @@ if lua_version < "5.3" then | |||
| 870 | debug_setmetatable(fd, compat_file_meta) | 874 | debug_setmetatable(fd, compat_file_meta) |
| 871 | end | 875 | end |
| 872 | 876 | ||
| 873 | return fd, err | 877 | if fd then |
| 878 | return fd | ||
| 879 | else | ||
| 880 | return fd, err, code | ||
| 881 | end | ||
| 874 | end | 882 | end |
| 875 | 883 | ||
| 876 | function M.io.tmpfile(...) | 884 | function M.io.tmpfile(...) |
| 877 | local fd, err = io_tmpfile(...) | 885 | local fd, err, code = io_tmpfile(...) |
| 878 | if fd and debug_setmetatable then | 886 | if fd and debug_setmetatable then |
| 879 | if not compat_file_meta_loaded then | 887 | if not compat_file_meta_loaded then |
| 880 | local file_meta = gmt(fd) | 888 | local file_meta = gmt(fd) |
| @@ -883,7 +891,11 @@ if lua_version < "5.3" then | |||
| 883 | debug_setmetatable(fd, compat_file_meta) | 891 | debug_setmetatable(fd, compat_file_meta) |
| 884 | end | 892 | end |
| 885 | 893 | ||
| 886 | return fd, err | 894 | if fd then |
| 895 | return fd | ||
| 896 | else | ||
| 897 | return fd, err, code | ||
| 898 | end | ||
| 887 | end | 899 | end |
| 888 | end | 900 | end |
| 889 | 901 | ||
