Truncate a file: Difference between revisions

m
Clarified explanation
(Added Lua version)
m (Clarified explanation)
Line 551:
=={{header|Lua}}==
Lua treats strings treat each byte as being invariably one wholebyte per character (hence the awkwardness of trying to use it with unicode), so it's safe to use string methods to truncate binary data.
<lang Lua>function truncate (filename, length)
local inFile = io.open(filename, 'r')
Anonymous user