kritiki
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 12323 |
|
|
| 28 Jul 2017 12:48 PM |
I'd use YouTube but every single time they take a hour to get to the script
|
|
|
| Report Abuse |
|
|
|
| 28 Jul 2017 01:01 PM |
There is one youtuber who I watched that taught me how to script. I'd recommend him. he get's to the point but makes it simple.His names Peas Factory (without the SPACE). Go to his advanced scripting playlist, it's the first vid. He speaks quite quietly but is experienced with scripts! Hope this helps. Reply if it did!
|
|
|
| Report Abuse |
|
|
kritiki
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 12323 |
|
| |
|
|
| 28 Jul 2017 01:03 PM |
darklord's advice is okay, but heres a quick rundown:
local WowSwagCoolJoushua = YOLOSWAGLMAOXD
while true do wait()
game.Workspace.Baseplate.Name = "Table" wait() game.Workspace.Baseplate.Name = "Table4" wait() game.Workspace.Baseplate.Name = "Table5" end
YOLOSWAGLMAOXD:()
game.Lighting.TimeOfDay = 0 |
|
|
| Report Abuse |
|
|
kritiki
|
  |
| Joined: 12 Jul 2012 |
| Total Posts: 12323 |
|
|
| 28 Jul 2017 01:08 PM |
| that is confusing Hans lol |
|
|
| Report Abuse |
|
|
ahwz
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 3230 |
|
|
| 28 Jul 2017 01:10 PM |
@Kritiki Either Hans is a troll or can't code.
|
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 31 Jul 2017 02:09 PM |
My expanaition might not be the best but let me give it a go. All tables do is hold data. Each table is "indexed" with 1 in lua. That means each "element" can be assesed with a number. They are by default handled as "arrays" which is simply a list of numbers for each element. Tables have certain properties with them and lua comes with some special built in functions you can use to manipulate these tables. Tables can hold anything,from numbers,userdata,strings,booleans,etc.
--Define a new table local tab = {}
--lets add a new element with the string "Hello" table.insert(tab,"Hello")
--lets print the first element print(tab[1]) --> Hello --the first index is 1 with a string element "Hello"
--lets add another element, as a number table.insert(tab,20)
print(tab[1],tab[2]) --> Hello 20 --there are now 2 indexes with elements "Hello" and 20
--lets remove one of the elements.
table.remove(tab,1) --will remove the first element, then shift the rest down.
print(tab[1]) --> 20 --20 is now the first element because we removed the string "Hello"
Thats the very basics of tables. Tables are probably one of the most powerful tools you can use.
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2017 02:19 PM |
if you know what arrays are you already know what a table is
my computer science teacher described them as shelves where each holds information that can be found in a specific location
so:
local myArray = {}
myArray[1] = "hello" myArray[2] = " " myArray[3] = "world" myArray[4] = "!"
so if you use a loop (i'd recommend a for loop) you can iterate through this array
for i,v in pairs(myArray) do print(myArray[i]) end
this should print "hello world!"
something very useful if you explore object oriented programming is that you can place objects with their own properties into these arrays and utilize the generic for loop
the ability to access any data you put into the table can be used for anything here's something that i came up with as i was typing this
local 8ball = {}
8ball[1] = "yes" 8ball[2] = "no" 8ball[3] = "ask later"
print(8ball[math.random(1,#8ball)]) -- this should print a random answer
i hope this helps |
|
|
| Report Abuse |
|
|