Lua Help: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mr Doom Bringer
m Changed protection level for "Lua Help" ([move=sysop] (indefinite))
>JulienDethurens
No edit summary
Line 1: Line 1:
<noinclude>__NOTOC__ {{clear floats}}</noinclude>
<noinclude>__NOTOC__ {{clear floats}}</noinclude>
{{TitledBox/start|heading=<noinclude>{{CatUp|Main Page}}</noinclude>{{CatItem|luaCode.png|Lua Help|Roblox Lua|Making your maps do crazy things}}}}
{{TitledBox/start|heading=<noinclude>{{CatUp|Main Page}}</noinclude>{{CatItem|luaCode.png|Lua Help|Roblox Lua|Making your maps do crazy things}}}}
[http://www.lua.org/ Lua] ('''not''' "LUA") is a simple programming language that is used in Roblox to add in customized content, like cars that drive, new weapons, etc.
[http://www.lua.org Lua] ('''not''' "LUA") is a simple programming language that is used in Roblox to add in customized content, like cars that drive, new weapons, etc.


This <noinclude>page</noinclude><includeonly>section</includeonly> provides tutorials to help users to learn Lua.
This <noinclude>page</noinclude><includeonly>section</includeonly> provides tutorials to help users to learn Lua.
Line 10: Line 10:


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Introduction series - read these first!</b>}}
{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Introduction series - read these first!</b>}}
{{CatList|Script Creation Walkthrough|Script Creation Walkthrough|How to create and run scripts.}}
{{CatList|Script Creation Walkthrough|Script Creation Walkthrough|Creating and running scripts.}}
{{CatList|Flowcharts|Flowcharts|Using diagrams to show the "flow" of a script.}}
{{CatList|Flowcharts|Flowcharts|Using diagrams to show the "flow" of a script.}}
{{CatList|Basic math|Basic Math|How to work with numbers in a script.}}
{{CatList|Basic math|Basic Math|Working with numbers in a script.}}
{{CatList|String|Strings|How to work with text in a script.}}
{{CatList|String|Strings|Working with text in a script.}}
{{CatList|Bool|Booleans|How to work with yes/no values in a script.}}
{{CatList|Bool|Booleans|Working with yes/no values in a script.}}
{{CatList|Variables|Variables|}}
{{CatList|Variables|Variables|}}
{{CatList|Conditional statements|Conditional Statements|How to make scripts do different things in different situations.}}
{{CatList|Conditional statements|Conditional Statements|Making scripts do different things in different situations.}}
{{CatList|Loops|Loops|How to make a piece of code run multple times.}}
{{CatList|Loops|Loops|Making a piece of code run multple times.}}
{{CatList|Functions|Functions|}}
{{CatList|Functions|Functions|}}
{{CatList|Tables|Tables|Storing multiple objects in one.}}
{{CatList|Tables|Tables|Storing multiple objects in one.}}
{{CatList|Generic for|Generic for|A special kind of loop for tables.}}
{{CatList|Generic for|Generic for|Using a loop to iterate through a table.}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Other Guides</b>}}
{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Other Guides</b>}}
Line 35: Line 35:
{{CatList|Data Persistence Tutorial|Data Persistence Tutorial|A tutorial on understanding and using data persistence in your places.}}
{{CatList|Data Persistence Tutorial|Data Persistence Tutorial|A tutorial on understanding and using data persistence in your places.}}
{{CatList|How To Increase and Decrease Vector3 Values|Using Vector3 Values|Shows how to use math with Vector3s.}}
{{CatList|How To Increase and Decrease Vector3 Values|Using Vector3 Values|Shows how to use math with Vector3s.}}
{{CatList|Leaderboards|Using Leaderboards|How to create your own Leaderboards.}}
{{CatList|Leaderboards|Using Leaderboards|Creating your own leaderboards.}}
{{CatList|Random numbers|Random Numbers|How to stop the same thing happening each time.}}
{{CatList|Random numbers|Random Numbers|Stopping the same thing from happening each time.}}
{{CatList|How To Make Plugins|How To Make Plugins|How can you make your own Roblox Studio toolbars and buttons?}}
{{CatList|How To Make Plugins|How To Make Plugins|Shows how you can make your own Roblox Studio toolbars and buttons.}}
{{CatList|Tools|Using Tools|How to create your own tools.}}
{{CatList|Tools|Using Tools|Creating your own tools.}}
{{CatList|HopperBins|Using HopperBins|The Tool's older version, using simpler Hopperbins.}}
{{CatList|HopperBins|Using HopperBins|The older version of tools, HopperBins.}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Reference</b>}}
{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Reference</b>}}
{{CatList|Scripting|Scripting|}}
{{CatList|Scripting|Scripting|}}
{{CatList|Function Dump|Functions|A list of all the global (don't need an object) functions.}}
{{CatList|Function Dump|Functions|A list of all the global functions.}}
{{CatList|Class Reference|Class Reference|All the types of Roblox [[Instance]]s.}}
{{CatList|Class Reference|Class Reference|All the types of Roblox [[RBX.lua.Instance (Object)|Instances]].}}
{{CatList|Built-in functions|Built-in Functions|Functions available in every [[Instance]].}}
{{CatListUrl|http://www.lua.org/manual/5.1|Lua 5.1 Reference Manual|Official definition of the Lua language. (some features not available in Roblox)}}
{{CatListUrl|http://www.lua.org/manual/5.1|Lua Reference Manual|Official documentation of Lua. (some features not available in Roblox)}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Example Scripts</b>}}
{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Example Scripts</b>}}
{{CatList|Cookbook|Cookbook|Large list of small example scripts}}
{{CatList|Cookbook|Cookbook|Large list of small example scripts}}
{{CatList|How do I create a brick?|Creating a Brick|Basic tutorial on how to create a brick using a script.}}
{{CatList|How do I create a brick?|Creating a Brick|Basic tutorial on creating a brick using a script.}}
{{CatList|Debounce|IS:What is Debounce?|Explains what Debounce is, and what it's used for.}}
{{CatList|Debounce|IS:What is Debounce?|Explains what a debounce is, and what it's used for.}}
{{CatList|Intro to Scripting: Make a Healing Potion|Making a Healing Potion|The Intro to Scripting series, how to Heal or Damage a Humanoid.}}
{{CatList|Intro to Scripting: Make a Healing Potion|Making a Healing Potion|The Intro to Scripting series, how to Heal or Damage a Humanoid.}}
{{CatList|Intro to Scripting: Make a Dance Floor|Make a Dance Floor|How to change the color of a brick, and create simple loops.}}
{{CatList|Intro to Scripting: Make a Dance Floor|Make a Dance Floor|Changing the color of a brick, and create simple loops.}}
{{CatList|Intro to Scripting: Make an Invisibility Tool|Make an Invisibility Tool|Shows how to create Tools and turn yourself invisible.}}
{{CatList|Intro to Scripting: Make an Invisibility Tool|Make an Invisibility Tool|Shows how to create Tools and turn yourself invisible.}}
{{CatList|How do I make VIP doors?|How to Create VIP Doors|Shows how to use tables, and to create a door that only certain people can enter.}}
{{CatList|How do I make VIP doors?|How to Create VIP Doors|Shows how to use tables, and to create a door that only certain people can enter.}}

Revision as of 22:30, 14 February 2012

Roblox LuaRoblox Lua
Making your maps do crazy things

Lua (not "LUA") is a simple programming language that is used in Roblox to add in customized content, like cars that drive, new weapons, etc.

This page provides tutorials to help users to learn Lua.

There are often multiple tutorials on the same subject, so if you don't understand something in one of them, try another!

If you still don't understand something, you can ask at Scripting Helpers. Note that you're more likely to get an answer if you ask a specific question than something general, and that if you have a problem with a piece of code, posting the code really helps people to find what the problem is. Posts just asking "How do I script?" or "Make me this" are usually ignored.

Introduction series - read these first!
Script Creation WalkthroughCreating and running scripts.
FlowchartsUsing diagrams to show the "flow" of a script.
Basic MathWorking with numbers in a script.
StringsWorking with text in a script.
BooleansWorking with yes/no values in a script.
Conditional StatementsMaking scripts do different things in different situations.
LoopsMaking a piece of code run multple times.
TablesStoring multiple objects in one.
Generic forUsing a loop to iterate through a table.
Other Guides
Beginner's Guide to ScriptingIf you've never worked with scripting before, look here.
Basic ScriptingShows you some of the basics of scripting.
Programming In LuaGuide to Lua by its creators. (partly out of date)
Introductions to Concepts
What are GUIs?This very in-depth guide explains what GUIs are.
Intro to WeaponsAn intro into the scripting of Weapons in Roblox.
Data Persistence TutorialA tutorial on understanding and using data persistence in your places.
Using Vector3 ValuesShows how to use math with Vector3s.
Using LeaderboardsCreating your own leaderboards.
Random NumbersStopping the same thing from happening each time.
How To Make PluginsShows how you can make your own Roblox Studio toolbars and buttons.
Using ToolsCreating your own tools.
Using HopperBinsThe older version of tools, HopperBins.
Reference
FunctionsA list of all the global functions.
Class ReferenceAll the types of Roblox Instances.
Lua 5.1 Reference ManualOfficial definition of the Lua language. (some features not available in Roblox)
Example Scripts
CookbookLarge list of small example scripts
Creating a BrickBasic tutorial on creating a brick using a script.
IS:What is Debounce?Explains what a debounce is, and what it's used for.
Making a Healing PotionThe Intro to Scripting series, how to Heal or Damage a Humanoid.
Make a Dance FloorChanging the color of a brick, and create simple loops.
Make an Invisibility ToolShows how to create Tools and turn yourself invisible.
How to Create VIP DoorsShows how to use tables, and to create a door that only certain people can enter.
How to Make RainCreating drops falling from the sky in random locations.
One-way DoorsHow to create doors that go only one direction.
Making Glow ScriptsMaking objects glow, with more complex loops.
How to TeleportAn overview of teleportation of players.
Making an OnClicked ScriptShows how to use the Mouse to trigger weapons.
How to Make Regenerating ModelsShows how to use variables to remove and create new models, even if they've been destroyed.
Using SoundsShows how to use events and work with Sounds.
How to Add Messages to Your PlaceShows how to use scripts to work with the Message object.
Using BodyPositionDetails how to use the BodyPosition object.
How to Build a CatapultA guide for medieval mayhem.
Using PlayerAddedHow to use the PlayerAdded event.
How to Create Talking CommandsA guide on how to use the Chatted event.
How to Make an ElevatorHow to make bricks move up and down in time.
How to Make MorphsCreating Morphs for your players.
How to Make Multi-Handle toolsCreating tools with more than one brick for a handle.
Money and Shop ScriptsHow to create an economy for your place.
Creating Black HolesShows how to simulate gravity fields in lots of objects.
How to make text on a brickHow to make words appear above a brick.
TeleportationHow to move characters to different positions.
How to Make Weapon Giving TeleportersMoving characters and giving them weapons.
How to Make Conveyor BeltsParts that move other parts.
How to Make RampsUsing CFrame to rotate parts.
How to Make LavaParts that hurt characters when touched.
How to Make CirclesUsing CFrame to arrange parts in a circle.
How to Make a Spiral StaircaseUsing CFrame to arrange parts in a spiral.