how to traverse a lua-table from C-Code?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how to traverse a lua-table from C-Code?

Corvin Zahn
Hi,

I would like to use LUA as a configuration language for a C++ programm. 
What I need, is a possibility to traverse a lua-table from C-Code without
knowing all the keys, like

  local i, v = next(t, nil)
  while i do
    local res = f(i, v)
    if res then return res end
    i, v = next(t, i)
  end

Is this possible?

Many thanks,
  C. Zahn
---
Corvin Zahn <[hidden email]>