AGENT_STEELMEAT Posted February 25, 2011 Share Posted February 25, 2011 Hey all, I have a simple function that will create a colShape and a radarArea from some definitions in a table. I've tried the code below, but get the following error: [22:44:34] WARNING: Bad argument @ 'createColPolygon' (string-defined function) [22:44:34] WARNING: Bad argument @ 'createRadarArea' (string-defined function) [22:44:34] WARNING: Bad argument @ 'addEventHandler' (string-defined function) [22:44:34] WARNING: Bad argument @ 'addEventHandler' (string-defined function) --{x, y, width, height, red, green, blue, alpha} local zones = { {1684, -2008, 200, 200, 0, 255, 0, 0}, {0, 0, 200, 200, 0, 255, 0, 0}} function buildSafeZones() for theKey, theZone in ipairs(zones) do local x = tonumber(zones[1]) local y = tonumber(zones[2]) local width = tonumber(zones[3]) local height = tonumber(zones[4]) local red = tonumber(zones[5]) local green = tonumber(zones[6]) local blue = tonumber(zones[7]) local alpha = tonumber(zones[8]) createColRectangle ( X, Y, Width, Height ) createRadarArea (X, Y, Width, Height, R, G, B, A) end end tysm once again. Link to comment
Castillo Posted February 25, 2011 Share Posted February 25, 2011 I think, they are strings not numbers. Link to comment
AGENT_STEELMEAT Posted February 25, 2011 Author Share Posted February 25, 2011 Umm, there aren't really any strings there, and I added the tonumber() operator to try and fix the problem. Link to comment
Castillo Posted February 25, 2011 Share Posted February 25, 2011 (edited) You are using invalid arguments... --{x, y, width, height, red, green, blue, alpha} local zones = { {1684, -2008, 200, 200, 0, 255, 0, 0}, {0, 0, 200, 200, 0, 255, 0, 0} } function buildSafeZones() for theKey, theZone in ipairs(zones) do local x = tostring(zones[1]) local y = tostring(zones[2]) local width = tostring(zones[3]) local height = tostring(zones[4]) local red = tostring(zones[5]) local green = tostring(zones[6]) local blue = tostring(zones[7]) local alpha = tostring(zones[8]) createColRectangle ( x, y, width, height ) createRadarArea (x, y, width, height, red, green, blue, alpha) end end X, Y doesn't exist, same with R, G, B, A they are red, green, blue, alpha and x,yz Edited February 25, 2011 by Guest Link to comment
AGENT_STEELMEAT Posted February 25, 2011 Author Share Posted February 25, 2011 Fail. I blame sleep deprivation. EDIT It's reading the table, but not creating the zones. I think I need to change stuff related to event handlers and such, but I'm not sure how. Anyone want to help me out on this? I'm confused >.< Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now