Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:36 PM |
Hello guys. I decided to start a new project and create an admin script. This won't be anything to the extent like kohls admin or anything, but I'd like to make it anyways for learning experience.
I need help with one thing first. Arguments. I've never really understood them in RBX.Lua (as I did in C++), so could somebody care to explain them to me? I know in C++ you can just do user inputting and it's easy to define arguments, but I'm not sure how to do this in RBX.Lua.
Thank you! |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:41 PM |
Normally, I would just tell you. When you already know C++ (Even if you only know the basics) I will refer you to the wiki, since the wiki will be especially useful once you know the terminology.
http://wiki.roblox.com/index.php?title=Arguments_and_parameters http://wiki.roblox.com/index.php?title=Function http://wiki.roblox.com/index.php/Variadic_function
If you are familiar with C style documentation, learning the API from links listed here should be a cinch. http://wiki.roblox.com/index.php?title=API:Class_reference
Other syntax stuff can be found here. http://wiki.roblox.com/index.php?title=AllTutorials#Scripting |
|
|
| Report Abuse |
|
|
Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:41 PM |
| Just in case you didn't understand, what I mean is how would you do "kill [p]" or "speed [p] [v]" |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:42 PM |
You mean kill(p) and speed(p, v) ? |
|
|
| Report Abuse |
|
|
Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:43 PM |
| Thank you for your quick reply! Just so you know my previous reply wasn't pointed toward you... I was typing it before you posted that. |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 04 Jan 2016 09:43 PM |
O. Command line-like arguments.
You have to use string patterns.
Search the Wiki up for the Chatted event. Then you just need to create a string pattern to capture what you want. For instance:
local Command = "kill Outputzz" local Capture = Command:match("kill ([%a][%w]-)") print(Cature) > Outputzz |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:44 PM |
I understand. c:
I hope that helps. :D
Also, the best guide I've seen for Lua concepts is a book called Programming In Lua, and version 1 is specific to the same version that Roblox uses (Of course Roblox removed some features) and version 1 is also available for free online. |
|
|
| Report Abuse |
|
|
Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:45 PM |
| Thanks guys! I'll study what both of you said and hopefully come up with a working solution! |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:46 PM |
"O. Command line-like arguments." Thank heavens for people who actually read, huh? (Self-deprecating humor of awkward embarrassment for the win) |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:47 PM |
I didn't read your full post, so I was referring to function arguments, not command line arguments and such. His post will help more, although if you get stuck, mine can help too I guess. :P |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 04 Jan 2016 09:47 PM |
| It was just my guess from his C++ background and the way he was typing what he wanted. It's a command-like argument form. |
|
|
| Report Abuse |
|
|
Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:50 PM |
| Well you where correct. I'm sorry for not stating that before. |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2016 09:52 PM |
| I read the middle paragraph, so that's what I based it off of. The first sentence implied he wanted a way of parsing commands. |
|
|
| Report Abuse |
|
|
Outputzz
|
  |
| Joined: 16 Aug 2014 |
| Total Posts: 6 |
|
|
| 04 Jan 2016 09:56 PM |
| So what's with all that ([%a][%w]-) stuff? |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 04 Jan 2016 09:58 PM |
It's a string pattern.
http://wiki.roblox.com/index.php?title=String_pattern |
|
|
| Report Abuse |
|
|