[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: passing lua table from c++ to lua script
- From: Patrick Rapin <toupie300@...>
- Date: Sun, 20 May 2012 18:31:31 +0200
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