Jump to content

How to manage flags


IIYAMA

Recommended Posts

  • Moderators
Posted

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']
Posted

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.

Posted (edited)

Sure, as I said above, '0x000010' is a hexadecimal value (its the HEX value of 16).

Edited by Guest
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...