Jump to content

[HELP] Fatal Problem


K4stic

Recommended Posts

says error: attempt to perform arithmetic on a nil value
setElementData ( source, "cans", tonumber(getElementData(source, "cans") or 0) + cans, false ) 

If you still want that in 1 line which I would unless you need to use current cans number more than once, you need to pay close attention to brackets:

setElementData ( source, "cans", ( tonumber( getElementData(source, "cans" ) ) or 0 ) + cans, false ) 

Link to comment

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...