[1.5.5] lua errors with ActorLife.lua - help please....!

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

[1.5.5] lua errors with ActorLife.lua - help please....!

#1 Post by jenx »

I have overwirtten ActorLife.lua in an addon I'm developing, with only minor changes, namely, adding some print functions. that's all.

But it now triggers on the world map endless lua errors:

Code: Select all

Lua Error: /mod/class/WorldNPC.lua:190: attempt to index field 'ActorLife' (a nil value)
	At [C]:-1 __index
	At /mod/class/WorldNPC.lua:190 die
	At /mod/class/WorldNPC.lua:141 attack
	At /mod/class/interface/ActorLife.lua:42 check
	At [string "return function(self, x, y, what, ...) local ..."]:1 checkAllEntities
	At /engine/interface/ActorAI.lua:64 aiCanPass
	At /engine/interface/ActorAI.lua:86 runAI
	At /mod/ai//worldnpcs.lua:85 doAI
	At /mod/class/WorldNPC.lua:155 act
	At /engine/GameEnergyBased.lua:129 tickLevel
	At /engine/GameEnergyBased.lua:64 tick
	At /engine/GameTurnBased.lua:51 tick
	At /mod/class/Game.lua:1386 

any idea why this is happening?
MADNESS rocks

St_ranger_er
Thalore
Posts: 172
Joined: Fri Jul 18, 2014 11:48 am

Re: [1.5.5] lua errors with ActorLife.lua - help please....!

#2 Post by St_ranger_er »

Any chance that you use original function in your superloaded? if so, check that original function called correctly i.e. first argument in brackets should be "self".

example from wiki https://te4.org/wiki/Addons

Code: Select all

local _M = loadPrevious(...)
local base_levelup = _M.levelup

function _M:levelup() --<- no arguments
  -- Do stuff "before" loading the original file

  -- execute the original function
  local retval = base_levelup(self) --<- but self here as first argument

  -- Do stuff "after" loading the original file

  -- return whatever the original function would have returned
  return retval
end

return _M

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: [1.5.5] lua errors with ActorLife.lua - help please....!

#3 Post by jenx »

Thanks!
MADNESS rocks

Post Reply