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 » Scripting Helpers
Home Search
 

Re: Lua Lesson 1 - Getting Started

Previous Thread :: Next Thread 
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:00 PM
To keep with the tradition, our first program in Lua just prints "Hello World":

print("Hello World")
If you are using the stand-alone Lua interpreter, all you have to do to run your first program is to call the interpreter (usually named lua) with the name of the text file that contains your program. For instance, if you write the above program in a file hello.lua, the following command should run it:
prompt> lua hello.lua
As a slightly more complex example, the following program defines a function to compute the factorial of a given number, asks the user for a number, and prints its factorial:

-- defines a factorial function
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end

print("enter a number:")
a = io.read("*number") -- read a number
print(fact(a))
If you are using Lua embedded in an application, such as CGILua or IUPLua, you may need to refer to the application manual (or to a "local guru") to learn how to run your programs. Nevertheless, Lua is still the same language; most things that we will see here are valid regardless of how you are using Lua. For a start, we recommend that you use the stand-alone interpreter (that is, the lua executable) to run your first examples and experiments.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:02 PM
Yes, lets start new people off with recursive functions and the io library...

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:04 PM
Are you being serious, or sarcastic... Can't tell over the computer...?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:05 PM
Completely and utterly sarcastic.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:09 PM
I don't see why not though, they need to learn.
Report Abuse
STEVEN1952 is not online. STEVEN1952
Joined: 13 Apr 2009
Total Posts: 145
01 Dec 2011 07:09 PM
@above what does that mean
Report Abuse
STEVEN1952 is not online. STEVEN1952
Joined: 13 Apr 2009
Total Posts: 145
01 Dec 2011 07:10 PM
sry 1 up
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:11 PM
You don't start learning Russian by learning the placement of gerunds and infinitives, do you? You start simple, and work your way to the complex-er stuff, not the other way.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:16 PM
I was always taught hard first oh and if you speak Russian...
Я очень не хочу вас поправить, но это заняло у меня одна неделя, чтобы узнать все, что я знаю, в России и в сценарии.
Need a translation?
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
01 Dec 2011 07:19 PM
Прохладный братан история. Скажи это еще раз.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:20 PM
That's some nice Google Translate ya got there. And new people aren't going to understand what a recursive function is. You gotta take into consideration the fact that the people reading this have no idea how Lua works and they want to read simple stuff that they can wrap their mind around quickly. If they get confused right away and can't figure this stuff out, then they'll just quit, but if you give them a good starting point with terminology they can understand, then they probably have a lower chance of giving up.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:23 PM
[ Content Deleted ]
Report Abuse
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:25 PM
1. Reported For Offsite Link
2. Yeah it's just so they can see simple learning, where do you think I learned? There obviously!
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:26 PM
You can post links to the Lua website.
And we have the wiki, which is specifically for roblox scripting. Roblox doesn't even allow the io library.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
01 Dec 2011 07:26 PM
@^

Yet you copy and past and don't even give credit.
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
01 Dec 2011 07:27 PM
I mean @Bloxxmod
Report Abuse
BloxxMod is not online. BloxxMod
Joined: 28 Nov 2011
Total Posts: 80
01 Dec 2011 07:37 PM
Credit was given in a previous post
Report Abuse
pokemon771 is not online. pokemon771
Joined: 28 Oct 2008
Total Posts: 8671
01 Dec 2011 07:38 PM
But not this post.

-~I know what your thinking.~-
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
01 Dec 2011 07:42 PM
A post made by him before this spam:

"Weak, Making my own lessons for everyone!!!"

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
Grove537 is not online. Grove537
Joined: 05 Feb 2010
Total Posts: 3478
01 Dec 2011 07:48 PM
lol swim, I'm learning Gerunds and infinitives in Language Arts xD

~The greatest free model is your mind~
Report Abuse
xCEMx is not online. xCEMx
Joined: 13 Nov 2011
Total Posts: 47
01 Dec 2011 07:55 PM
@Swim

Oh me? I'm the alt of BloxxMod :)
Report Abuse
Leeav is not online. Leeav
Top 100 Poster
Joined: 07 Sep 2006
Total Posts: 1905
01 Dec 2011 08:46 PM
Haha this is straight out of "Programming in Lua" Second Edition, the first page.. I purchased it about a year ago. lol...
Report Abuse
Jellyfish403 is not online. Jellyfish403
Joined: 12 May 2010
Total Posts: 951
01 Dec 2011 08:51 PM
SwimGuy made a good point. You may take your knowledge of knowing the basics for granted and skipping right ahead, someone with no knowlegde of Lua would of had their head disintigrate.
Report Abuse
DihydrogenOxide is not online. DihydrogenOxide
Joined: 20 Feb 2011
Total Posts: 642
01 Dec 2011 08:51 PM
@leeav

And I just got banned for posting a link to it :P
I thought we could post links to the Lua site...

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
Jellyfish403 is not online. Jellyfish403
Joined: 12 May 2010
Total Posts: 951
01 Dec 2011 08:52 PM
@Leeav, LOL Really? I knew there was something odd about Bloxx's writing. XD
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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