Are people using these?

Hello, I was searching in my Lua book and I saw some functions that I don’t saw and use these functions. Are someone using these in real games (not testing)? The functions:

collectgarbage:

  • Used
  • Not used

0 voters

getfenv:

  • Used
  • Not used

0 voters

newproxy:

  • Used
  • Not used

0 voters

setfenv:

  • Used
  • Not used

0 voters

type over typeof:

  • Used
  • Not used

0 voters

select:

  • Used
  • Not used

0 voters

Some of these functions I know how to use them but I don’t know why someone would use them.

If you vote something, please say what you voted and why.

There was arleady atleast 5 voters. Can you please say why you voted what you voted? Example: I wont use select in my entire life because … .

Some of these I don’t know what do, and some of them I just don’t find useful in my code. Type() is probably the one I use most, but other than that, I don’t use any of these :man_shrugging:

1 Like

I whould use typeof over type as it gives you more information over roblox things.

2 Likes

I really want to see why some people voted Used at newproxy and getfenv if there are better funtions/ways to do.

I used getfenv on my admin system, as I wanted to call the function with the name of the command that player typed. Soo I didnt had to do a if statement for every function I made.

i often don’t use newproxy too much but it can be useful, to create userdata (which i don’t think there is a replacement for ) and for making unique values and such.

You can simply use tables, tables are more usefull than getfenv and if.

@Jaycbee05 what is newproxy? I only know it can have a meta table and nothing more.

This thread gives a really nice look into it:

What I meant is this:

function Hi()
print("Hello!")
end

getfenv()[Message]() -- (Message is a string value that is "Hi") doing this will call the function that has the name of that string. Which is the function Hi.
1 Like

Some people may put incorect commands, so I think you should wrap

getfenv()[Message]()

in a pcall.

This is personal to me.

collectgarbage - No real reason to use this. You cannot control the garbage collector in Roblox. If you want information on memory usage, there are other functions available for this.

getfenv/setfenv - There are actually a variety of uses for these functions. Off the top of my head, some include sandboxing, cheat detections, and well, environment manipulation. Not used much in game development, but for other purposes it can be quite useful.

newproxy - As others have stated, making your own objects. Off the top of my head, some other uses include locking modules/data and sandboxing purposes.

type over typeof - When I want to know if something is just a userdata (I have no care what kind). I’ve used this for serializing data.

select - Parameter counting. Argument manipulation. I don’t use this often.