Use the length operator (#) instead of table.getn.

table.getn was deprecated in Lua 5.1 in favor of #, the length operator.
See: http://www.lua.org/manual/5.1/manual.html#7.2
This commit is contained in:
Gerardo Marset 2013-02-25 20:28:28 -02:00
parent d548a78e55
commit 56893e9dcd
11 changed files with 19 additions and 19 deletions

View file

@ -259,7 +259,7 @@ function parse_path(path)
path = path or ""
--path = string.gsub(path, "%s", "")
string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end)
for i = 1, table.getn(parsed) do
for i = 1, #parsed do
parsed[i] = unescape(parsed[i])
end
if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
@ -277,7 +277,7 @@ end
-----------------------------------------------------------------------------
function build_path(parsed, unsafe)
local path = ""
local n = table.getn(parsed)
local n = #parsed
if unsafe then
for i = 1, n-1 do
path = path .. parsed[i]