Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
foo()
-- or alternatively:
call(#foo, _movie)

View 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

View file

@ -0,0 +1,2 @@
put getAllUserFunctions()
-- [#sum, #double, #getAllUserFunctions]

View 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

View 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]

View file

@ -0,0 +1,3 @@
foo(1,2,3)
-- or alternatively:
call(#foo, _movie, 1, 2, 3)

View file

@ -0,0 +1,4 @@
on foo (a, b)
if voidP(b) then b = 1
return a * b
end

View file

@ -0,0 +1,4 @@
put foo(23, 2)
-- 46
put foo(23)
-- 23

View 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

View file

@ -0,0 +1,2 @@
put sum (1,2,3)
-- 6

View 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

View file

@ -0,0 +1,3 @@
l = [1,2,3]
put map(l, #doubleInt)
-- [2, 4, 6]

View file

@ -0,0 +1 @@
x = foo(1,2)