1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-26 18:50:38 +01:00
server-nalc/mods/wiki/strfile.lua
Ombridride 2e895a7790 Merge server with github repository
Pas mal de changement n’ont pas été pushé sur le github du serveur,
voici l’occasion de faire une bonne synchronisation :)
2014-11-16 22:23:16 +01:00

29 lines
491 B
Lua

strfile = { }
function strfile.open(s)
return {
_buf = s,
_pos = 1,
_readline = function(self)
if self._pos == nil then
return nil
end
local nl = self._buf:find("\n", self._pos, true)
local line
if nl then
line = self._buf:sub(self._pos, nl - 1)
nl = nl + 1
else
line = self._buf:sub(self._pos)
end
self._pos = nl
return line
end,
lines = function(self)
return self._readline, self, true
end,
close = function(self) end,
}
end