I thought I'd share this snippet of code to help anyone struggling with the hatelist and event_hate_list in lua
Code:
function event_hate_list(e)
local hate_list = e.self:GetHateList().entries
if(hate_list == nil) then
e.self:Shout("hate_list is nil")
return;
else
e.self:Shout("hate_list is OK")
end
for hate_entry in hate_list do
local hate_entry_mob = hate_entry.ent -- C++ Lua_HateEntry::GetEnt is bound to 'ent' property
local hate_value = hate_entry.hate
e.self:Shout("Hate list includes " .. hate_entry_mob:GetCleanName() .. " who has a hate value of ".. hate_value )
end
end
Also a question: how do I get the lua equivalent of Perl $hate_state?