Creating a usermessage object?

Is there a way to ‘create’ a usermessage object? There is a function I’m trying to use, but it’s usually only used with usermessages. As such, the only arg is the usermessage arg, so I was wondering if I could somehow create a usermessage object and send it that.

It’s hard for me to explain so here is some example code:
[lua]
//Note - this would all be clientside

//Here is the function I’m trying to access, that I also do not want to edit for certain reasons
function DoThing(um)
local ply = um:ReadEntity()
//Do something important with ply
end
usermessage.Hook(“DoThing”, DoThing)

//Here is my own function trying to use this
function RunDoThing()
DoThing(?) //Can I put anything here and make it work?
end
[/lua]

Why can’t you just have:

[LUA]
function DoThing( ent )
local ply = ent
end

function RunDoThing( um )
DoThing(um:ReadEntity())
end
[/lua]

Or is it that you want to pass all of the usermessage data to the next function?

Well the thing is that I can’t change the DoThing function at all. It is part of something else I didn’t make and I don’t want to mess with it. I just need to find a way to give an argument to it without doing a usermessage.

I don’t see why do you need that?

I agree with Robotboy655 there is a key piece of information were not understanding, if your trying to send a specific player entity from the server to the client that can be done easily but from the client to the client?? your adding an extra step that’s overcomplicating things it seems like…

Maybe we could help better if we understood what you wanted the end result to be.

I think you’re wanting to be able to plug your own entity into that function rather than having the server send that entity via umsg, correct?

In that case then there’s no way to do what you want without either editing the original function, or just copying everything that function does into another function that doesn’t rely on umsg.

If the umsg is only used to read the entity, then editing the original function won’t hurt you at all.

[lua]function DoThing(data)
local ply
if (type(data) == “Entity”) then
ply = data
else
ply = data:ReadEntity()
end

//Do something important with ply

end
usermessage.Hook(“DoThing”, DoThing)

//Here is my own function trying to use this
function RunDoThing()
DoThing(LocalPlayer()) //Can I put anything here and make it work?
// If it’s a pointer to an entity, now you can.
end[/lua]