I'm currently using luarpc in my program to make interprocess communication. The problem now is that due to my tolua++ binding which stores class instances as userdata im unable to use any of those functions cause luarpc cant handle userdata. My question now is if would be possible (and how) to transmit userdata if you know that its always only a pointer (4 Bytes) and has a metatable attached for call and indexing operations.
2
There are 2 answers
5
Nicol Bolas
On
You can't.
It doesn't matter if the userdata is a pointer or an object. The reason you can't arbitrarily RPC through them is because the data is not stored in Lua. And therefore LuaRPC cannot transmit it properly.
A pointer into your address space is absolutely worthless for some other process; even moreso if it's running on another machine. You have to actually transmit the data itself to make the RPC work. LuaRPC can do this transmission, but only for data that it can understand. And the only data it understands is data stored in Lua.
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in LUA
- lua udp not working between computers
- Guitar Hero-like Timing Mechanic
- Call download lua script in app
- Erlang spawning large amounts of C processes
- does redis cluster support transactions ?
- I am writing an IVR using Lua and want to run xml script in between
- How to read a Bunch of files in a directory in lua
- How to pause a Lua script?
- lua 5.2.3 source lstring.c function luaS_resize
- Torch Lua: Why is my gradient descent not optimizing the error?
- How can I convert a character code to a string character in Lua?
- LuaInterface issue with vs 2015 RC project
- Storing Lua callback functions
- Compile Lua Code and store the bytecode in a new file
- Is there something wrong with my onRelease call?
Related Questions in RPC
- Call IConnectionPoint::Advise cause a crash
- How do I implement RMI using the computers connected in the same network?
- The RPC server is unavailable while creating user in Active Directory
- What is the equivalent of RPC in new Unity Networking?
- Protobuf-Net: implementing server, rpc controller and rpc channel
- Perl XML-RPC output format/schema
- How do you correctly exit a remote job in a PowerShell session
- Error:1722 Getting session names
- Python: use xmlrpc module with a server requiring authentication
- Java inter-process communication in year 2015 (with no boiler-plate)?
- How can I configure hadoop rpc's timeout?
- Passing of value from one separate application to another
- install gRPC and got make error
- How to make an application get know that some other application is offline (RPC)?
- Connect to RPC Server in Docker
Related Questions in LUA-USERDATA
- Lua userdata array access and methods
- Lua light userdata
- Setting userdata as namespace in Lua
- How to extend SWIG's userdata in Lua code?
- ./lua/addtest.lua:9: attempt to index local 'testobj' (a userdata value)]]
- use lua's lightuserdata to register timer callback
- How to get better performance out of Lua when iterating array of structs
- Lua RPC and userdata
- Wireshark dissector in Lua - userdata
- Save reference to Lua's userdata
- Getting reference to userdata in a table using luaL_ref?
- how to find out the type of userdata when Lua calling C/C++
- What happens if I push userdata twice using the same key?
- Lua userdata not available
- How to register Lua userdata correct from Delphi?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Ok i got it working now. What i did is for userdata args/returns i send the actual ptr + metatable name(typename) to the client. the client then attaches a metatable with an __index method that creates a new helper with the typename and appends a helper with the field you want to access. when you then call or read a field from that userdata the client sends the data for calling a field of the typetable and the userdata to the server.
ReadVariable:
Write Variable:
userdata indexing:
well i more or less rewrote the complete rpc library to work with named pipes and windows but i think the code should give anyone enough information to implement it.
this allows code like:
on the clientside. it currently doesnt allow to add new fields but well this is all i need for now :D