Help With Looking Up Res.spells

Language: JP EN DE FR
New Items
329 users online
Forum » Windower » Support » Help with looking up res.spells
Help with looking up res.spells
Posts: 505
By KujahFoxfire 2022-10-13 05:38:57
Link | Quote | Reply
Hi Guys,

I am having an issue with a lookup im using to find spells in the spells.lua file.

The lookup seems to stop after ID 511 for some reason, and any spells higher than this are not checked. Code snippet below:
function lookup_spell_id(spell)
	for k,v in ipairs(res.spells) do
		windower.add_to_chat(007,k..' '..v.en)
		if v.en == spell then
			spell_index = k

Any ideas on how I can get it to check the entire file?

Edit: Just noticed there is no 512 in the spells.lua, added a dummy to test and it got a bit further. Is there anyway to get the code to continue on if theres a missing entry?
Server: Shiva
Game: FFXI
user: Rairin
Posts: 1623
By Shiva.Thorny 2022-10-13 06:01:52
Link | Quote | Reply
ipairs iterates by increasing index until an index is missing, there's no 512 so that won't work

you can use pairs, which will check every table entry, but doesn't guarantee any specific order
Posts: 505
By KujahFoxfire 2022-10-13 06:04:35
Link | Quote | Reply
Cool that works, thanks Thorny!
Log in to post.