generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Arguments?

Previous Thread :: Next Thread 
Outputzz is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jan 2016 09:42 PM
You mean
kill(p)
and
speed(p, v)
?
Report Abuse
Outputzz is not online. 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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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 is not online. 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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image