lua-users home
lua-l archive

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


///////////// 'main.c':
#include <stdio.h>
#include <assert.h>
#include <dirent.h>

int main ()
{
    DIR *dir = opendir (".");
    assert (dir);
    int fd = dirfd (dir);
    char buffer[64];
    assert (!dup2 (fd, 0));
    char* argv[] = {"./script.lua", NULL};
    char* envp[] = {NULL};
    execve ("./script.lua", argv, envp);
    return 0;
}

------------- 'script.lua':
print (io.read ("*a"))