Moderators IIYAMA Posted March 24, 2013 Moderators Posted March 24, 2013 I have a problem with manage flags. After I store them in a table they got changed to a number and I can't use them any more. Even if I change them to a string, I also have to change them back to a number to use them again. addEventHandler( "onResourceStart", resourceRoot, function () flagSetInData(33,1,0x000010) end) local flagState = {"pro","std","poor"} function flagSetInData(weapon,state,flag) setWeaponProperty(weapon,flagState[state],flag) end Bad argument @ 'setWeaponProperty' [Expected weapon-property at argument 3, got number '32'] Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ixjf Posted March 24, 2013 Posted March 24, 2013 Lua assumes 0x000010 is a number (it's the hexadecimal value of 16). I don't know if there is any other way to use 0x000010 in a table without converting it to a string, sorry for not helping much. I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
Moderators IIYAMA Posted March 24, 2013 Author Moderators Posted March 24, 2013 Even if I write it like this: local A= 0x000010 it will lose it's correct value. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ixjf Posted March 24, 2013 Posted March 24, 2013 (edited) Sure, as I said above, '0x000010' is a hexadecimal value (its the HEX value of 16). Edited March 28, 2013 by Guest I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
DiSaMe Posted March 24, 2013 Posted March 24, 2013 0x000010 is a number. 0x000010 is 16. Debugscript clearly says what the problem is. You missed the property name (should be "flags") in your case and used the value (which should be the 4th argument) in its place. -
Moderators IIYAMA Posted March 24, 2013 Author Moderators Posted March 24, 2013 O_O whops.... thank you, my fail Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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