For those of you that are unfamiliar with Lua outside of Roblox's environment, io.write is a Lua function that takes a variable amount of arguments, and prints them to the current output file.
However, unlike print, it does not delimit its arguments with tabs, it doesn't call tostring on its arguments, and there is no implicit newline appending.
Here is a demonstration of io.write
io.write("Hello world")
io.write("Goodbye world")
yields
Hello worldGoodbye world
It doesn't implicitly add a newline, to combat this, you would append it yourself.
io.write("Hello world\n")
io.write("This is in a new line now\n")
yields
Hello world
This is in a new line now
And if write receives a non-string, non-number argument:
io.write({})
yields an exception with the following message
bad argument #1 to 'write' (string expected, got table)
Ok back to my question
I would like to use io.write as it would let me do this without needing to concatenate everything into a single string only to print it:
for i = 0, 19 do
-- just an example
io.write(i, ' ')
end
io.write('\n')
-- blah blah blah
Output: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Also it would let me write printf ;)
-- simple google search will suffice to explain printf if you don't know how it works
local function printf(s, ...)
local formatted = s:format(...)
io.write(formatted)
return #formatted
end
local n = math.random(0, 9)
printf("Number: %d", n)
I really just want it for the fact that it doesn't append any newlines

3 comments
Don't quote me on it, but I don't think it's possible. Roblox only gives us stuff like print, warn, and error for managing the output log.
To add, you could always write a module that displays itself in a custom-made interface/log that has the same functionality as io.
Of course you could, but is it practical at all? No. @mrmcmuffinz123