added an ipairs() table traversal function like the one from the basic library

git-svn-id: svn://anubis/anaglym/trunk@227 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2010-01-27 21:15:56 +00:00
parent c4f6310c2d
commit 65ee4ccab2

12
ag.cc
View File

@ -82,6 +82,18 @@ namespace ag
" return next, table, nil\n"
"end\n"
"ipairs = function(table)\n"
" local iter_func = function(t, i)\n"
" i = i + 1\n"
" if t[i] == nil then\n"
" return nil\n"
" else\n"
" return i, t[i]\n"
" end\n"
" end\n"
" return iter_func, table, 0\n"
"end\n"
"ag.createAMotor = function()\n"
"end\n"
);