Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I compare with return value instead of just "function"?

Asked by 6 years ago

I'm trying to compare a number (pos) with another number (returned by getComp()). I get this error: Workspace.Part.Script:28: attempt to compare number with function. Line 28 is the one with > . What am I doing wrong?

function getComp(vector, comp)
    return 1
end

function split(part, pos, axis)
    -- Test input

    if (pos > getComp(part.size, axis)) then
        print("pos too large")
    end
end
0
`pos` is most likely a function because getCom() is returning an integer.  Zafirua 1348 — 6y

2 answers

Log in to vote
0
Answered by
clc02 553 Moderation Voter
6 years ago
Edited 6 years ago

I'm not actually getting any errors using your function, copied, with tests of split(Instance.new("Part"), 1, 1) and split(Instance.new("Part"), 10, 1)

Copy the full script?

0
Thanks for the quick answer! Hullburg 12 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I figured it out. I was calling split() like this:

split(part, split, axis)

The problem was i used the same name for a variable and a function (split). I changed it and now I'm getting some other wierd error: startScript re-entrancy has exceeded 3 . Probably an unrelated issue though.

Answer this question