Calling : function based on just name of the function

In my framework I have the ability to wrap custom objects to roblox instances. From this object they can access and set properties of the wrapped instance easily, through self. But, it doesn’t work with instance functions.

image

I need it to run the function as :, not . I get this error.

image

1 Like

Side note: functions don’t have names


Remember that a:b() is the same as a.b(a) so you will want to do t.Wrapped[index](t.Wrapped) to pass that self argument.

By the way not x == y is not the same as x ~= y. Just use the latter anyways.

3 Likes

Thanks, don’t know why I didn’t just think of passing the table itself through the function. Now I have the problem of what to return.

image

image

It’s still playing the sound, which is good, so I am not sure why this error is happening. I’m thinking it shouldn’t be nil because it JUST played it.

Edit: changing this
image

to this
image

gets rid of the error. But I don’t want to play sounds like this :stuck_out_tongue:

1 Like

Bump, I haven’t got it fully working yet.

1 Like

Figured it out myself. Just return a function that calls the instance method.

2 Likes