Forum

> > CS2D > Scripts > Lua bug (?)
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua bug (?)

2 replies
To the start Previous 1 Next To the start

old Lua bug (?)

Deleted User

Quote
Hey guys, when I was creating script I descovered a strange thing

1
if not player(id, 'weapontype') == 74 then return end

So after this line, the function will work only if wrench is equipped on the player

but the function is working even if I'm holding knife!

And then I tried

1
if player(id, 'weapontype') == 74 then else return end

And function worked well! Why?!

old Re: Lua bug (?)

DC
Admin Off Offline

Quote
did you try
1
if not (player(id, 'weapontype') == 74) then return end
?

Lua might try to negate player(id, 'weapontype') and not the comparison.

old Re: Lua bug (?)

Deleted User

Quote
Oh thanks for explaining. I get it now.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview