Added 'loops' test case.
This script tests the generic for loop using a Lua closure as the iterator function, which is currently broken.
This commit is contained in:
22
src/test/res/loops.lua
Normal file
22
src/test/res/loops.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- This script tests the "generic" for loop with a script iterator.
|
||||
|
||||
local function stuff()
|
||||
local function i(o)
|
||||
if o.counter > 3 then
|
||||
return nil
|
||||
else
|
||||
local v = o.counter
|
||||
o.counter = v + 1
|
||||
return v
|
||||
end
|
||||
end
|
||||
return i, { counter=1 }
|
||||
end
|
||||
|
||||
local function testfor()
|
||||
for x in stuff() do
|
||||
print(x)
|
||||
end
|
||||
end
|
||||
|
||||
testfor()
|
||||
BIN
src/test/res/loops.luac
Normal file
BIN
src/test/res/loops.luac
Normal file
Binary file not shown.
Reference in New Issue
Block a user