M MY Multiplayer: Wiki
Lado
Tipo

fileRead

Compartilhado

Lê bytes de um arquivo a partir da posição atual e avança a posição.

string fileRead(file file, int count)

Parâmetros

NomeTipoDescrição
filefileUm arquivo aberto por fileOpen ou fileCreate.
countintQuantos bytes ler, 0 ou mais.

Retorno

Os bytes lidos. Pode ter menos que count (ou ser vazio) perto do fim.

Exemplo

local file = fileOpen("data.bin", true)
while file and not fileIsEOF(file) do
    local chunk = fileRead(file, 4096)
    print(#chunk)
end
if file then fileClose(file) end

Veja também