So here's my now trying to do the loop I described by setting the total champions in a var:
Code: Select all
-- Setup champion array and graphics
path = pathimg .. "champions/"
champions_total = 12
for s = 1, champions_total do
-- Set current champion name
c_name = dsb_get_charname(s)
-- Put current champion in array
champions[s] = {
shortname = c_name,
selected = false
}
-- Create graphics entries
gfx["c_pic_" .. c_name] = dsb_get_bitmap(path .. "pic_" .. c_name)
gfx["c_text_" .. c_name] = dsb_get_bitmap(path .. "text_" .. c_name)
gfx["port_" .. c_name] = dsb_get_bitmap(path .. "post_" .. c_name)
end
This is some new code I'm creating so that I don't have to hardcode my champions table by hand. But it doesn't work because this bit doesn't work:
Code: Select all
for s = 1, champions_total do
-- Set current champion name
c_name = dsb_get_charname(s)
DSB complains of "FATAL LUA ERROR: select-champions.lua:16: Invalid character index 1". So for some reason
dsb_get_charname(s) is not working...?
Is this because the dungeon.lua hasn't been parsed yet? (I'm doing this in a file that's loaded in my manifest).