3 /* This file a quick method to test the lua interface, it just loads
4 * and runs the lua script file at argv[1] in an interpreter with
5 * the mp module preloaded. I need to do it this way because the
6 * primary tester in Hans Hagen who is on Windows, and the cross-compiler
7 * doesn't know (or rather, I don't) how to build lua for a dynamic library.
19 extern void luaopen_mp (lua_State *L);
21 int main (int argc, char **argv){
24 if ((argc!=2) || argv[1][0] == '-') {
25 fprintf(stdout,"First and only argument should be a lua script.\n");
30 fprintf(stderr,"Can't create the Lua state.");
35 status = luaL_loadfile(L, argv[1]);
37 status = lua_pcall(L, 0, 0, 0);
39 fprintf(stderr,"call of %s failed: %s\n",argv[1], lua_tostring(L,-1));
42 fprintf(stderr,"compile of %s failed\n",argv[1]);
45 return (status ? EXIT_FAILURE : EXIT_SUCCESS);