Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clua_pushcallback has been added to allow definining metamethods with Go... #3

Merged
merged 1 commit into from Dec 15, 2012

Conversation

losinggeneration
Copy link

clua_pushcallback has been added to allow definining metamethods with Go functions.

This adds the ability to push Go functions as C closures. It's code hand patched from @stevedonovan's golua repo. Specifically: stevedonovan@3a27ba8 without the changes to GoInterface.

His luar project, which uses golua, then only needs small changes to become compatible with your golua fork.

@aarzilli
Copy link
Owner

I'm not very excited by the idea of having two functions in the module interface (PushCallback and PushGoFunction) with largely overlapping use cases. Without your explanation I would have never guessed why your PushCallback was needed.

Can we find another way? for example:

a) Make PushGoFunction do what PushCallback does. Both result in a callable object that calls a go function. Does it break anything?

b) If the only thing PushCallback is useful for is defining metamethods maybe we should use it internally and export a SetMetaMethod function?

Given I don't know the ramifications of (a) I would lean towards (b). Am I missing something?

Thank you.

@stevedonovan
Copy link

On Wed, Dec 12, 2012 at 4:07 PM, Alessandro Arzilli
notifications@github.com wrote:

b) If the only thing PushCallback is useful for is defining metamethods
maybe we should use it internally and export a SetMetaMethod function?

That does feel more logical - it was intended for that purpose only.
(PushCallback is ... vague. I am not very good at naming things ;)

steve d.

@aarzilli
Copy link
Owner

Do we have an agreement? :)

@stevedonovan
Copy link

On Wed, Dec 12, 2012 at 6:26 PM, Alessandro Arzilli
notifications@github.com wrote:

Do we have an agreement? :)

Personally I'd be happy with any solution which allows metamethods to
be defined - that's the only extra feature that luar needs from golua.

BTW, what version of Go are you using? I ask because the makefile
does not work with Go 1.0.3 - it can't find the include at the top.

steve d.

@aarzilli
Copy link
Owner

Personally I'd be happy with any solution which allows metamethods to be defined - that's the only extra feature that luar needs from golua.

Ok.

BTW, what version of Go are you using? I ask because the makefile does not work with Go 1.0.3 - it can't find the include at the top.

I'm using go 1.0.3, what include is not working?

@aarzilli aarzilli merged commit 4a78253 into aarzilli:master Dec 15, 2012
@aarzilli
Copy link
Owner

I changed PushCallback to SetMetaMethod

@stevedonovan
Copy link

On Sat, Dec 15, 2012 at 8:10 AM, Alessandro Arzilli
notifications@github.com wrote:

I'm using go 1.0.3, what include is not working?

Sorry Alessandro, I was looking at the original afitz repo! Now
everything makes sense, and I don't have to look after my own fork!

steve d.

@aarzilli
Copy link
Owner

Don't delete it yet though, I think I'm going to merge it once this pull request is completely settled.

shanemhansen pushed a commit to shanemhansen/golua that referenced this pull request Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants