Veldehar
December 15th, 2009, 19:54
So, I've got these lovely little scripts that pull up racial resistances. They work great except for one little thing. When I create a new character, which doesn't yet have a race, all my racial checks are returning a nil value script error. Naturally, once I put a race in and reopen the character sheet, all is well.
What bit of code do I need to eliminate this error?
My current script looks like this:
function onInit()
life1temp = window.getDatabaseNode() .getChild("resistances.life.race");
life1temp.onUpdate = update;
update();
end
function update()
life1rr = window.getDatabaseNode() .getChild("resistances.life.race");
setValue(life1rr.getValue());
end
Veldehar the Lua Noob
What bit of code do I need to eliminate this error?
My current script looks like this:
function onInit()
life1temp = window.getDatabaseNode() .getChild("resistances.life.race");
life1temp.onUpdate = update;
update();
end
function update()
life1rr = window.getDatabaseNode() .getChild("resistances.life.race");
setValue(life1rr.getValue());
end
Veldehar the Lua Noob