#scripting learning
1 messages · Page 1 of 1 (latest)
you need to make stuff
?
if you never make stuff you get stuck in tutorial hell
understandable
make games or just small systems with ur current knowledge
and eventually with more ambitious projects youll get better
i started with watching alvinblox for the very basics like functions and events
np
;compile
print(hi)
nil
;compile
print("hi")
hi
you learn by doing
;compile
;compile print("bro")
how??
you gotta do lua
;compile print("hello")
if you know how to do it
lua
ik
"""lua
but how do i put under
except not with quotations
so just type after lua
g````
;compile ```
print("bro")
do 3 `'s and add lua no space
;compile```lua
print("Like This?")
;compile ```lua
local text="supercalifragilisticexpialidocious"
for i=1, #text do
print(string.sub(text,0,i))
end```
s
su
sup
supe
super
superc
superca
supercal
supercali
supercalif
supercalifr
supercalifra
supercalifrag
supercalifragi
supercalifragil
supercalifragili
supercalifragilis
supercalifragilist
supercalifragilisti
supercalifragilistic
supercalifragilistic
yes
why did it not print then
redo it
;compile ``` lua
print("lua")
its 3 's add lua no space then press enter
;compile ```lua
print("how")
k
;compile ```lua
while true do
wait(1)
print("Alr")
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:3: 'end' expected (to close 'while' at line 1) near <eof>
local text="s,u,p,e,r,c,a,l,i,f,r,a,g,i,l,i,s,t,i,c,e,x,p,i,a,l,i,d,o,c,i,o,u,s"
for i=1, #text do
print(string.sub(text,0,i))
end```
;compile ```lua
while true do
wait(1)
print("ok")
end
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:2: attempt to call a nil value (global 'wait')
stack traceback:
prog.lua:2: in main chunk
[C]: in ?
ye
and task library
or sum
;compile ```lua
local text="s,u,p,e,r,c,a,l,i,f,r,a,g,i,l,i,s,t,i,c,e,x,p,i,a,l,i,d,o,c,i,o,u,s"
for i=1, #text do
print(string.sub(text,0,i))
end```
s
s,
s,u
s,u,
s,u,p
s,u,p,
s,u,p,e
s,u,p,e,
s,u,p,e,r
s,u,p,e,r,
s,u,p,e,r,c
s,u,p,e,r,c,
s,u,p,e,r,c,a
s,u,p,e,r,c,a,
s,u,p,e,r,c,a,l
s,u,p,e,r,c,a,l,
s,u,p,e,r,c,a,l,i
s,u,p,e,r,c,a,l,i,
s,u,p,e,r,c,a,l,i,f
s,u,p,e,r,c,a,l,i,f,
s,u,p,e,r,c,a,l,i,f,
;compile ```lua
local thing = 1
thing = thing + 5
print(thing)
6
;compile
local x,y=9,8
print(x*y)
72
i try a table
;compile ```lua
local table = {
thing = 1,
thing2 = 2
}
print(table[thing])
nil
;compile
local myTable={
thing1=1,
thing2=2,
}
print(myTable)```
table: 0x6176fdaacee0
because roblox has a built in table function
o
;compile
local myTable={
thing1=1,
thing2=2,
}
print(myTable[thing1])
nil
see
thing1 doesn't exist as a variable
its just in the table
;compile
local myTable={
thing1=1,
thing2=2,
}
print(myTable[1])```
nil
;compile
local myTable={
[“Thing2”]={number=2},
[“Thing3”]={number=5},
}
for i, v in pairs(myTable) do
print(v,i)
end```
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:2: unexpected symbol near '<\226>'
like i said
roblox has a built-in table function
but others do not
thats why when you try to print "myTable" it does table: x0dfs8f0ds8f80xsf8d0s
so how you do it here?
j
i meant like print a single value
this is a horrible way to set tables (thats my opinion)
practice
local text = tostring(io.read())
local fulltext = ""
for v in text:gmatch(".") do
fulltext = fulltext .. v
print(fulltext)
end
;compile | peanut butter & jelly
p
pe
pea
pean
peanu
peanut
peanut
peanut b
peanut bu
peanut but
peanut butt
peanut butte
peanut butter
peanut butter
peanut butter &
peanut butter &
peanut butter & j
peanut butter & je
peanut butter & jel
peanut butter & jell
peanut butter & jell
It stops due to limits
;compile | bacons nice
b
ba
bac
baco
bacon
bacons
bacons
bacons n
bacons ni
bacons nic
bacons nice
Check out developpers forums and documentations
;compile
local text =“blah1234567890”
for i=1, #text do
print(string.sub(text,0,i)
end
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:1: unexpected symbol near '<\226>'
;compile
local text =“blah”
for i=1, #text do
print(text)
end
/opt/wandbox/lua-5.4.7/bin/lua: prog.lua:1: unexpected symbol near '<\226>'
Table is a global variable
text is a strong, not a table
this works wdym
a strong??
String*