1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("kill","repchange")
function repchange(id,src)
	reputation[src][faction[id]]=reputation[src][faction[id]]-1
	for _,f in ipairs(factions[faction[id]].allies) do --line 125
		reputation[src][allies[f]]=reputation[src][allies[f]]-0.5
	end
	for _,f in ipairs(factions[faction[id]].enemies) do
		reputation[src][factions[faction[id]].enemies[f]]=reputation[src][factions[faction[id]].enemies[f]]-0.5
	end
end
CS2D Console has written
LUA ERROR: sys/lua/space_rpg/main.lua:125: bad argument #1 to ipairs (table expected, got nil)
The table:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
factions = {
--........
[4] = {
name = "TeleTec Inc.",
initrep = 10,
tag = "[TEL]",
	allies = {1,2,3},
	enemies = {5},
},
--........
}
I have NO idea what's wrong with this thing. Halp?
[Lua Problem] Weird table issue
1 
Offline
Worked like a charm when I changed places of the arguments. Thanks a lot.