1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 11:10:29 +00:00

Make io.write() accept multiple args

This is just to bring the io API from CC close the the io API from normal lua, which accept multiple args for io.write().
This commit is contained in:
Wilma456 (Jakob0815) 2017-09-11 15:47:30 +02:00 committed by GitHub
parent 1fdfcdb5f2
commit 0115bc8dca

View File

@ -23,8 +23,10 @@ local g_defaultOutput = {
bClosed = false,
close = function( self )
end,
write = function( self, _sText )
_G.write( _sText )
write = function( self, ... )
for k, v in ipairs( { ... } ) do
_G.write( v )
end
end,
flush = function( self )
end,
@ -115,8 +117,10 @@ function open( _sPath, _sMode )
file.close()
self.bClosed = true
end,
write = function( self, _sText )
file.write( _sText )
write = function( self, ... )
for k, v in ipairs( { ... } ) do
file.write( v )
end
end,
flush = function( self )
file.flush()
@ -144,8 +148,10 @@ function open( _sPath, _sMode )
file.close()
self.bClosed = true
end,
write = function( self, _number )
file.write( _number )
write = function( self, ... )
for k, v in ipairs( { ... } ) do
file.write( v )
end
end,
flush = function( self )
file.flush()