Add CLDC-1.0 based implementation of io libraries.

This commit is contained in:
James Roseborough
2008-12-05 22:29:07 +00:00
parent b8237ec872
commit 308e909df1
7 changed files with 483 additions and 128 deletions

View File

@@ -11,6 +11,7 @@ checkallpass('io.close',{{f}})
checkallerrors('io.close',{notanil},'bad argument #1')
-- io.input ([file])
f = io.open("abc.txt","r")
checkallpass('io.input',{{nil,f,"abc.txt"}})
checkallerrors('io.input',{nonstring},'bad argument #1')

View File

@@ -24,8 +24,8 @@ for i,v in ipairs(t) do
print( string.format("%q",tostring(v)), type(v))
end
local h = io.open("abc.txt", "a")
print( 'h', io.type(h) )
local h,s = io.open("abc.txt", "a")
print( 'h', io.type(h), s )
print( 'write', h:write('\nmore text\neven more text\n') )
print( 'close', h:close() )
@@ -61,6 +61,12 @@ for l in io.lines() do
print( string.format('%q',l) )
end
local count = 0
io.tmpfile = function()
count = count + 1
return io.open("tmp"..count..".out","w")
end
local a = io.tmpfile()
local b = io.tmpfile()
print( io.type(a) )