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 best solutions below
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++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in LUA
- How to make a ServerScript wait for a LocalScript to fire a RemoteEvent
- global const variables in lua 5.4
- Backpack for roblox simulator game
- Calling an event with a delay in Roblox Studio. How to do?
- lghub lua script presskey
- LGHUB Lua script
- In pairs for loop not looping inside of another in pairs loop
- Lua syntax error expected '(' near update_rotation
- 64 unsigned integers in Lua 5.3/5.4 do not behave like in "Programming in Lua"
- How to write a lua pattern that is aware of escaped characters?
- having trouble installing neovim plugin
- Incorrect number comparison result (Lua)
- Lua: is there a need to use hash of string as a key in lua tables
- continuations in lua, is not working while trying extending it
- Neovim Kickstart config "E5113: Error while calling lua chunk: vim/_editor.lua:0: attempt to compare two table values" everytime I open neovim
Related Questions in RPC
- 'Git clone' displays a 'RPC failed' error
- How to solve error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: early EOF
- how to know the default time for xmlrpc timeout
- Raytune sent message larger than max error python
- about problem with data size returned by dubbo generalization call
- e.g connecting go microservice made with rpcx with nestJs(popular node framework)
- RPC call using the solana python library throws error on AsyncClient
- How to properly set a shared golang interface for hashicorp go-plugin to expose a method that accepts json string input
- Which HTTP method is correct for RPC over HTTP triggering asynchronous action eventually changing server status?
- How to modify property values through reflection
- DEP0001: Unexpected Error: SmartDeviceException - Incompatible version of the RPC stub. [0x80131500] during UWP app deployment to Windows phone
- How to initialize a RetryProvider for multiple RPC endpoints in ethers.js
- RPC Calls in Unity 3D / Photon Fusion 2
- RPC/DCOM Implementation
- Is there a way to await for an if statement to be true?
Related Questions in LUA-USERDATA
- 2d array access with lua userdata
- How to get better performance out of Lua when iterating array of structs
- How do user values in Lua C API and lua_newuserdatauv function in particular work?
- Reuse lua_newuserdata() returned pointer
- Lua life cycle of userdata and uservalue
- LuaU script (Roblox), how can I make a Key get pressed with a script
- Is it possible to dump the properties/methods of a type userdata variable?
- C++ - How to define userdatum with Lua table as member?
- Convert Userdata to hex in Wireshark Dissector
- Attempt to call a userdata value
- lua - check if userdata is nil
- Converting Go Struct instance to Lua table
- Getting reference to userdata in a table using luaL_ref?
- How to pass userdata from one Lua chunk to another in C++
- How to index a converted userdata value?
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)
Popular # Hahtags
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?
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