Alright,
So I am making an Anti-Exploit Module and I want the User to be able to Set the settings through the loader script Eg...
1 | require( 03048303 ) |
I have seen it on Admins before. I know it is possible. I just don't know how. And I couldn't find anything on the Roblox Wiki about it.
Thanks, Enomphia
(Response that helps will be upvoted :D)
You could make your module return a function (or a metatable with __call
to prevent using getfenv
on it), which accepts a table with settings as an argument.
Example:
1 | local Settings = { } |
2 |
3 | --module's code blabla |
4 |
5 | return function (t) |
6 | --verify if the table is valid or something |
7 | Settings = t |
8 | end |
Or the one with __call
:
1 | local Settings = { } |
2 |
3 | --module's code blabla |
4 |
5 | return setmetatable ( { } , { __call = function (self, t) |
6 | --verify if the table is valid or something |
7 | Settings = t |
8 | end , __metatable = false } ) |
And you would pass the settings like this:
1 | require( 03048303 )( { |
2 | Something = true |
3 | } ) |