HEX
Server: nginx/1.28.3
System: Linux ip-172-31-12-242 6.17.0-1007-aws #7~24.04.1-Ubuntu SMP Thu Jan 22 21:04:49 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //usr/share/swig4.0/lua/argcargv.i
/* -------------------------------------------------------------
 * SWIG library containing argc and argv multi-argument typemaps

   Use it as follows:

     %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
     extern int mainApp(size_t argc, const char **argv);

   then from lua:

     args = { "arg0", "arg1" }
     mainApp(args)

 * ------------------------------------------------------------- */

%{
SWIGINTERN int SWIG_argv_size(lua_State* L, int index) {
  int n=0;
  while(1){
    lua_rawgeti(L,index,n+1);
    if (lua_isnil(L,-1))
      break;
    ++n;
    lua_pop(L,1);
  }
  lua_pop(L,1);
  return n;
}
%}

%typemap(in) (int ARGC, char **ARGV) {
  if (lua_istable(L,$input)) {
    int i, size = SWIG_argv_size(L,$input);
    $1 = ($1_ltype) size;
    $2 = (char **) malloc((size+1)*sizeof(char *));
    for (i = 0; i < size; i++) {
      lua_rawgeti(L,$input,i+1);
      if (lua_isnil(L,-1))
   break;
      $2[i] = (char *)lua_tostring(L, -1);
      lua_pop(L,1);
    }
    $2[i]=NULL;
  } else {
    $1 = 0; $2 = 0;
    lua_pushstring(L,"Expecting argv array");
    lua_error(L);
  }
}

%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
  $1 = lua_istable(L,$input);
}

%typemap(freearg) (int ARGC, char **ARGV) {
  free((char *) $2);
}