Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
3
Task/Call-a-function/Lingo/call-a-function-1.lingo
Normal file
3
Task/Call-a-function/Lingo/call-a-function-1.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
foo()
|
||||
-- or alternatively:
|
||||
call(#foo, _movie)
|
||||
17
Task/Call-a-function/Lingo/call-a-function-10.lingo
Normal file
17
Task/Call-a-function/Lingo/call-a-function-10.lingo
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
on getAllUserFunctions ()
|
||||
res = []
|
||||
repeat with i = 1 to _movie.castlib.count
|
||||
c = _movie.castlib(i)
|
||||
repeat with j = 1 to c.member.count
|
||||
m = c.member[j]
|
||||
if m.type<>#script then next repeat
|
||||
if m.scripttype=#movie then
|
||||
functions = m.script.handlers()
|
||||
repeat with f in functions
|
||||
res.append(f)
|
||||
end repeat
|
||||
end if
|
||||
end repeat
|
||||
end repeat
|
||||
return res
|
||||
end
|
||||
2
Task/Call-a-function/Lingo/call-a-function-11.lingo
Normal file
2
Task/Call-a-function/Lingo/call-a-function-11.lingo
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
put getAllUserFunctions()
|
||||
-- [#sum, #double, #getAllUserFunctions]
|
||||
6
Task/Call-a-function/Lingo/call-a-function-12.lingo
Normal file
6
Task/Call-a-function/Lingo/call-a-function-12.lingo
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
on double (someList)
|
||||
cnt = someList.count
|
||||
repeat with i = 1 to cnt
|
||||
someList[i] = someList[i] * 2
|
||||
end repeat
|
||||
end
|
||||
9
Task/Call-a-function/Lingo/call-a-function-13.lingo
Normal file
9
Task/Call-a-function/Lingo/call-a-function-13.lingo
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
l = [1,2,3]
|
||||
double(l)
|
||||
put l
|
||||
-- [2, 4, 6]
|
||||
|
||||
l = [1,2,3]
|
||||
double(l.duplicate())
|
||||
put l
|
||||
-- [1, 2, 3]
|
||||
3
Task/Call-a-function/Lingo/call-a-function-2.lingo
Normal file
3
Task/Call-a-function/Lingo/call-a-function-2.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
foo(1,2,3)
|
||||
-- or alternatively:
|
||||
call(#foo, _movie, 1, 2, 3)
|
||||
4
Task/Call-a-function/Lingo/call-a-function-3.lingo
Normal file
4
Task/Call-a-function/Lingo/call-a-function-3.lingo
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
on foo (a, b)
|
||||
if voidP(b) then b = 1
|
||||
return a * b
|
||||
end
|
||||
4
Task/Call-a-function/Lingo/call-a-function-4.lingo
Normal file
4
Task/Call-a-function/Lingo/call-a-function-4.lingo
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
put foo(23, 2)
|
||||
-- 46
|
||||
put foo(23)
|
||||
-- 23
|
||||
7
Task/Call-a-function/Lingo/call-a-function-5.lingo
Normal file
7
Task/Call-a-function/Lingo/call-a-function-5.lingo
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
on sum ()
|
||||
res = 0
|
||||
repeat with i = 1 to the paramCount
|
||||
res = res + param(i)
|
||||
end repeat
|
||||
return res
|
||||
end
|
||||
2
Task/Call-a-function/Lingo/call-a-function-6.lingo
Normal file
2
Task/Call-a-function/Lingo/call-a-function-6.lingo
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
put sum (1,2,3)
|
||||
-- 6
|
||||
20
Task/Call-a-function/Lingo/call-a-function-7.lingo
Normal file
20
Task/Call-a-function/Lingo/call-a-function-7.lingo
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
----------------------------------------
|
||||
-- One of the five native iterative methods defined in ECMAScript 5
|
||||
-- @param {list} tList
|
||||
-- @param {symbol} cbFunc
|
||||
-- @param {object} [cbObj=_movie]
|
||||
-- @return {list}
|
||||
----------------------------------------
|
||||
on map (tList, cbFunc, cbObj)
|
||||
if voidP(cbObj) then cbObj = _movie
|
||||
res = []
|
||||
cnt = tList.count
|
||||
repeat with i = 1 to cnt
|
||||
res[i] = call(cbFunc, cbObj, tList[i], i, tList)
|
||||
end repeat
|
||||
return res
|
||||
end
|
||||
|
||||
on doubleInt (n)
|
||||
return n*2
|
||||
end
|
||||
3
Task/Call-a-function/Lingo/call-a-function-8.lingo
Normal file
3
Task/Call-a-function/Lingo/call-a-function-8.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
l = [1,2,3]
|
||||
put map(l, #doubleInt)
|
||||
-- [2, 4, 6]
|
||||
1
Task/Call-a-function/Lingo/call-a-function-9.lingo
Normal file
1
Task/Call-a-function/Lingo/call-a-function-9.lingo
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = foo(1,2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue