Hallo Leute,
ich wollte mal von jmd., der sich mit den "file" Funktionen auskennt wissen, wie ich alle Namen aus einer .txt ( jeder Name steht in einer Zeile), in eine Tabelle bekomme!?
Ich habe es bis jetzt so probiert:
Code
function oFile()
local hFile = fileOpen("test.txt") -- attempt to open the file
if hFile then -- check if it was successfully opened
local buffer
local size = fileGetSize ( hFile ) -- as long as we're not at the end of the file...
buffer = fileRead(hFile, size) -- ... read the next 500 bytes...
-- ... and output them to the console
test = { string.gsub(buffer," ",",") }
outputChatBox(tostring(test[1]))
fileClose(hFile) -- close the file once we're done with it
else
outputConsole("Unable to open test.txt")
end
end
addCommandHandler("file", oFile)
Alles anzeigen
Leider gibt Mta ingame immer noch "nick1 Nick2 nick3" aus . Da wird nicht mal das Leerzeichen durch ein Komma ersetzt!?