in Lua 5.2, table.getn no longer exists

This commit is contained in:
Enno Rehling 2014-08-03 20:51:22 +02:00
parent afd41286b5
commit 71056cc2e5
3 changed files with 5 additions and 3 deletions

View File

@ -80,7 +80,8 @@ local function market_action(r)
end
local markets = {}
local function markets.update()
function markets.update()
local r
for r in regions() do
market_action(r)

View File

@ -9,7 +9,7 @@ local jokes = {
}
local function ponnuki_brain(u)
local i = math.random(table.getn(jokes))
local i = math.random(#jokes)
u:add_notice("Eine Botschaft von " .. tostring(u) .. ": " ..jokes[i])
local d = math.random(6)
local r = u.region:next(d-1)

View File

@ -189,6 +189,7 @@ end
if config.install then
confdir = config.install .. '/' .. confdir
end
print(confdir)
read_xml(confdir .. 'config.xml', confdir .. 'catalog.xml')
local path = 'scripts'
@ -201,7 +202,7 @@ require 'eressea'
local rules = {}
if config.rules then
rules = require('eressea.' .. config.rules)
eressea.log.info('loaded ' .. table.getn(rules) .. ' modules for ' .. config.rules)
eressea.log.info('loaded ' .. #rules .. ' modules for ' .. config.rules)
else
eressea.log.warning('no rule modules loaded, specify a game in eressea.ini or with -r')
end