Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 10:47 PM |
local table = {
"blah", --blah
}
how to run "blah"? i've seen xsixx do it. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2013 10:56 PM |
What do you mean by 'run'? A string is not a function, so it can't be 'run'. |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 13 Jun 2013 10:57 PM |
local Table = {Blah = function() print("Blah") end} Table.Blah() |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 10:57 PM |
execute
"blah" --blah holds all of this code
how to run code in blah in table
adasdasd |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2013 10:58 PM |
local tab { blah = function(val) print(val) end }
tab.blah("lol")
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 10:58 PM |
@mr
will it work for string as the name? |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
| |
|
|
| 13 Jun 2013 10:59 PM |
Typo:
local tab { blah = function(val) print(val) end }
tab.blah("lol")
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 11:04 PM |
http://www.roblox.com/xSIXx-Admin-item?id=119023775
please tell me how xsixx did it then.. |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2013 11:06 PM |
Take a good look at the GetCmd function starting on line 534.
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 11:09 PM |
| i dont see were he is calling it though |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2013 11:16 PM |
Here's an example.
for i,v in pairs(commands) do if cmd == v[1] then finalcmd = v[1] funccmd = v[2] break end end
Now, the structure of the table commands is:
local commands = { { "name", function func_name() --code here end }, { "name2", function func2_name() --code here end } }
Now, the variable v would be the tables inside the main table. v[1] would be the strings "name" and "name2". v[2] would be the two functions. Both the variables finalcmd (the name) and funccmd (the function) are returned.
Then look at the function OnChat starting at line 591. Here's a snippet.
cmd, func, args = GetCmd(msg) if cmd and func and args then if cmd == "script" then func(spe, args[1])
cmd is the name from before. func is the function from before. Ignore args. If the name is script, it calls the function.
And that answers your question.
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
mummymark
|
  |
| Joined: 10 Sep 2011 |
| Total Posts: 610 |
|
|
| 13 Jun 2013 11:24 PM |
local message = Instance.new('Message', game.Workspace) message.Text = "blah blah blah blah blah functions are cool"
|
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 13 Jun 2013 11:25 PM |
THANK YOU
I GOT IT TO WORK.
|
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
|
| 13 Jun 2013 11:27 PM |
No problem. ;)
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|