louiskk
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 228 |
|
|
| 01 Jul 2015 01:32 PM |
| Well, I'm trying to make a system where I can search a module script for a function and I have the name of the function in string format. Is there any way for me to return the function with the string, or maybe convert it into another form perhaps. |
|
|
| Report Abuse |
|
|
Twitdoof
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 199 |
|
| |
|
louiskk
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 228 |
|
|
| 01 Jul 2015 01:36 PM |
| If you don't know what I'm talking about, why are you here? |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2015 01:39 PM |
local iter = require(264586303); local module = require(script.ModuleScript);
local func;
for x,y in iter(module) do if type(y) == 'function' and x == 'NameOfFunction' then func = y; end end
--------------------
This stores the function within a variable called 'func', retrieved from the module defined in the second line. |
|
|
| Report Abuse |
|
|
louiskk
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 228 |
|
|
| 01 Jul 2015 01:43 PM |
| What's iter? As in what does the first require mean? |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2015 01:45 PM |
It's an extended iterator. It makes things easier. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 01 Jul 2015 01:58 PM |
Kot you are over complicating this. Lua already has iterator functions. Why are you trying to add something unnecessary?
for i,v in next, thing do
end
"Talk is cheap. Show me the code." - Linus Tivalds |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2015 02:22 PM |
| Time, I know about that, I simply enjoy adding additional features to the already provided API items. I'm not being like IcyFires (you might not know who he is, he was here a long time ago), I'm simply building onto it. The function is very small, it simply returns the built-in iterator (next) but with additional checks. |
|
|
| Report Abuse |
|
|