lua-users home
lua-l archive

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


If you want to simplify your task, I would suggest you to have a look
to my library LuaClassBasedCall [1]
To show you an example, with it, your first code could have been
written like this:

#include "lgencall.hpp"

int main() {
  lua::Lua L;
  L.PCall("function MTable(t) for i=1,#t do print(t[i]) end end");
  static const char* str[2] = {"10.10.1.1", "10.10.1.2"};
  const char* err = L.PCall("MTable(...)", lua::Input(2, str));
  if(err)
    fprintf(stderr, "Failed to run script: %s\n", err);
  return 0;
}

[1] https://github.com/prapin/LuaClassBasedCall