How to set up Function "userdataType(* v)"?

DorrieSMO

Member
I searched multiple PK3s for a glimpse of how this vanilla game function is set up, but I cant find any PK3s that used the function. Please do some console print debugging on how this is set up and notify me how it is set up correctly, here is how I set it up. (I had to local player because it returned nil randomly)
Lua:
local player = userdataType(* "player_t")
 
I searched multiple PK3s for a glimpse of how this vanilla game function is set up, but I cant find any PK3s that used the function. Please do some console print debugging on how this is set up and notify me how it is set up correctly, here is how I set it up. (I had to local player because it returned nil randomly)
Lua:
local player = userdataType(* "player_t")
userdataType is a function used to know what kind of userdata is the argument you give to it.

If its sole argument (refered by the wiki as v, but it can be named whatever you prefer) is a map object, the function will return a string that reads "mobj_t". If the argument is a player, the string "player_t" is returned instead.
Iirc, if the argument is not an userdata, the function will just return the string "unknown", or it might trigger an error, I guess...
TL;DR: the function returns a string with the name of the type of userdata given to it.

Here's the part of the Functions page at wiki were userdataType can be seen, along with a list of every userdata type the function could return an string of: wiki.srb2.org/wiki/Lua/Functions#userdataType

Hope this helps! ^^
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top