lua - How to: Communicate with a subprocess -
i have go program starts c/lua process. i'd communicate between two. example, in middle of run of child (the c/lua process), i'd ask parent (the go program) calculations , wait result. not keen use stdin/stdout communication, used regular output. thinking of using sockets communication, don't want reinvent wheel.
- what obvious choices kind of communication?
- is there (more or less) simple standard way pass objects between lua , go? if not, text blobs suffice.
- are protocol buffers suitable this? looks overkill, have no experience here.
besides usual ipc methods you've mentioned (yeah, unix socket protobuf should it, , stdin/stdout well), if run c/lua code embedded in program, , not start process, can communicate between languages directly.
using cgo
module, go code can call c functions, , embedded c code can call go functions. see here: http://golang.org/cmd/cgo/#hdr-c_references_to_go
also, have couple embeddable lua binding libraries go can try, let call lua code , let lua code call go. see https://github.com/aarzilli/golua , https://github.com/stevedonovan/luar/
Comments
Post a Comment