Help With Looking Up Res.spells

言語: JP EN DE FR
2010-06-21
New Items
398 users online
フォーラム » Windower » Support » Help with looking up res.spells
Help with looking up res.spells
Offline
Posts: 544
By KujahFoxfire 2022-10-13 05:38:57  
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:
Code
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
			return
		end
	end
end


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?
 Shiva.Thorny
Offline
サーバ: Shiva
Game: FFXI
user: Rairin
Posts: 1656
By Shiva.Thorny 2022-10-13 06:01:52  
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
Offline
Posts: 544
By KujahFoxfire 2022-10-13 06:04:35  
Cool that works, thanks Thorny!
Log in to post.