Improve iolib test.
This commit is contained in:
@@ -469,7 +469,7 @@ public class IoLib extends OneArgFunction {
|
||||
private static Varargs iowrite(File f, Varargs args) throws IOException {
|
||||
for ( int i=1, n=args.narg(); i<=n; i++ )
|
||||
f.write( args.checkstring(i) );
|
||||
return LuaValue.TRUE;
|
||||
return f;
|
||||
}
|
||||
|
||||
private Varargs ioread(File f, Varargs args) throws IOException {
|
||||
|
||||
@@ -5,6 +5,15 @@ print( 'platform', platform )
|
||||
--
|
||||
-- C version on Windows will add change \n into \r\n for text files at least
|
||||
--
|
||||
local tostr,files,nfiles = tostring,{},0
|
||||
tostring = function(x)
|
||||
local s = tostr(x)
|
||||
if s:sub(1,4) ~= 'file' then return s end
|
||||
if files[s] then return files[s] end
|
||||
files[s] = 'file.'..nfiles
|
||||
nfiles = nfiles + 1
|
||||
return files[s]
|
||||
end
|
||||
print( io ~= nil )
|
||||
print( io.open ~= nil )
|
||||
print( io.stdin ~= nil )
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user