Jump to content

Condition function


Recommended Posts

In this function terminates before for, why?

    function facJob( hitElement, matchingDimension ) 
    if isElementWithinMarker ( hitElement, source ) then 
    local attachedElements = getAttachedElements ( hitElement ) 
    if attachedElements then 
    outputChatBox('0') --    output 0 and all. 
    for _, ElementValue in ipairs ( attachedElements ) do 
        outputDebugString ( '1' ) 
        if getElementModel ( ElementValue ) == 3016 then break else 
            vbjob ( source, hitElement ) 
            break 
        end 
    end 
    else outputChatBox('2') vbjob ( source, hitElement ) 
    end 
    end 
    end 

Link to comment
Probably because element are not attached at line 4, so as there is no else to the if statement it would just end

Sorry, I don't really understand you. What should i do?

I know that the table is created with the elements, but there are no elements. Then would it be written debug 'bad argument', but here it is not.

Link to comment

getAttachedElements will output a table with all the elements attached to it, however if there are no elements attached to it it will return a blank table.

If there are no elements attached to hitElement then line 6 will loop through an empty table.

Good luck :D

Link to comment
getAttachedElements will output a table with all the elements attached to it, however if there are no elements attached to it it will return a blank table.

If there are no elements attached to hitElement then line 6 will loop through an empty table.

Good luck :D

I want to know what returns this table? nil - does not work.

This is my main question. thx

    if attachedElements == nil then 

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