Invalid table insertion, fix kaetemi/ryzomclassic#124

ryzomclassic-develop
kaetemi 5 years ago
parent 09cb0ea5d0
commit 7e232462d0

@ -304,6 +304,27 @@ table.getn = function(table)
return #table
end
if oldInsertFunction == nil then
oldInsertFunction = table.insert
end
table.insert = function(t, key, value)
if not key then
debugWarning(string.format("Inserting '%s' '%s' in table with %d elements, nil is not a valid appending value, inserting false instead to fix behaviour!", key, value, #t))
if value then
oldInsertFunction(t, false, value)
else
oldInsertFunction(t, false)
end
else
if value then
oldInsertFunction(t, key, value)
else
oldInsertFunction(t, key)
end
end
end
-- redefine the hardcoded 'pairs' function to use the redefined 'next'

@ -3962,16 +3962,20 @@ function Translator.translateDialog(entity, context)
end
rtAction = Translator.createAction("chat_step", rtNpcGrp.Id, param)
assert(rtAction)
table.insert(rtDialogOk.Children, rtAction)
assert(param.Index)
assert(param.Emote)
assert(param.Says)
assert(param.WhoNoEntity)
table.insert(endParam.Indexs, param.Index)
table.insert(endParam.Grps, param.WhoGrp)
table.insert(endParam.Whos, param.Who)
table.insert(endParam.Grps, param.WhoGrp or '')
table.insert(endParam.Whos, param.Who or '')
table.insert(endParam.Emotes, param.Emote)
table.insert(endParam.Says, param.Says)
table.insert(endParam.WhoNoEntitys, param.WhoNoEntity)
else -- !if isKindOf("ChatStep")
componentIndex, component = next(entity.Components, componentIndex)
end

Loading…
Cancel
Save