PDA

View Full Version : Must be syntax...



GrimmSpector
March 3rd, 2016, 20:02
Debugging this code, as soon as I open the ruleset I get the console error below, and if I remove the brackets around the compound if statement, I instead get the same error but it says it expected 'then' near '<eof>'...I don't see any errors, hopefully someone can tell me what silly mistake I've made, the code may look complex but the individual blocks when taken apart from their ifs and loops work.

Error:

Runtime Notice: Reloading ruleset
Script Error: [string "charsheet_main:standard"]:1: ')' expected near '<eof>'
Database Notice: Campaign saved.


Script:

[CODE]
function updatePips()
local curstd = window.standard_current.getValue();
local maxstd = window.standard.getValue();
for i=1,maxstd do
window["standard" .. tostring(i)].setHealth("pip_filled");
end
if curstd ~= maxstd then
if (curstd < maxstd and curstd > 0) then
for i=(curstd + 1),maxstd do
window["standard" .. tostring(i)].setHealth("pip_empty");
end
end
if curstd == 0 then
for i=1,maxstd do
window["standard" .. tostring(i)].setHealth("pip_empty");
end
end
end
end
[CODE]

Moon Wizard
March 3rd, 2016, 23:15
My guess is that it is because you are including < and > characters within an XML definition. (such as a template)

If you are using inline Lua script in an XML file (such as for windowclasses, controls or templates), you must escape the "<", ">", and "&" characters to "&lt;", "&gt;", and "&amp;", respectively.

Regards,
JPG

GrimmSpector
March 3rd, 2016, 23:18
Hahaha, what a bonehead mistake, thanks so much Moon, it's what I've been doing everywhere else, and didn't even think of it!