1 #include "../luaextl.c"
2 #include "../readconfig.c"
4 static const char tostringstr
[]=
6 "print('first arg is a ' .. type(arg[1]))\n"
7 "local basis = arg[1]()\n"
9 "print('first arg returned a ' .. type(basis))\n"
10 "if type(basis)=='string' then\n"
11 " result = string.format('%q', basis)\n"
13 " result = tostring(basis)\n"
15 "print('result is a ' .. type(result))\n"
16 "print('result is ' .. result)\n"
28 if(!extl_loadstring(tostringstr
, &tostringfn
))
31 if(!extl_loadstring("print('testing\\n'); return 'test'", &fn
))
33 fprintf(stderr
, "Calling extl_call...\n");
34 if(!extl_call(tostringfn
, "f", "s", fn
, &retstr
))
40 if(strcmp("\"test\"", retstr
) != 0){
41 fprintf(stderr
, "Result was '%s' instead of 'test'", retstr
);
55 result
+= test_tostring();
57 fprintf(stderr
, "Result: %d\n", result
);