Advertisement
Terrah

recursion

May 2nd, 2015
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local test = {};
  2. table.insert(test,"this");
  3. table.insert(test,"is");
  4. table.insert(test,"recursion!");
  5.  
  6. local function RecursivePrint(index)
  7.     local text = test[index];
  8.     if text == nil then
  9.         return;
  10.     else
  11.         print(text);
  12.         RecursivePrint(index+1);
  13.     end
  14. end
  15.  
  16. RecursivePrint(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement