lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I need to build a lua table representing the files tree from a given
directory. I succeeded doing that both with the help of luaposix and
with an extension of my own.

My third experiment was this one:

https://gist.github.com/960827

It outputs a lua program that can be loaded by a lua script to get the result.

What I need to do now is convert that script to a lua C function that
can return the table without having to persist it to disk.

When you call a C function from lua you get a new lua stack each time,
right? But if I call the function recursively from the C side then I
would get a _single_ stack that would keep growing and become
difficult to manage.

My question is what would be the best strategy to change that C
function to return a lua table instead of outputting to the stdout? Is
there a way to create a new stack from the C code so I can make
recursive calls from the C extension?

Txs
--------------------------------------------------------------
EmmanuelOga.com - Software Developer