** If your system does not support `stdout', you can just remove this function. ** If you need, you can define your own `print' function, following this ** model but changing `fputs' to put the strings at a proper place ** (a console window or a log file, for instance). */
| 29 | ** (a console window or a log file, for instance). |
| 30 | */ |
| 31 | static int luaB_print (lua_State *L) { |
| 32 | int n = lua_gettop(L); /* number of arguments */ |
| 33 | int i; |
| 34 | lua_getglobal(L, "tostring"); |
| 35 | for (i=1; i<=n; i++) { |
| 36 | const char *s; |
| 37 | lua_pushvalue(L, -1); /* function to be called */ |
| 38 | lua_pushvalue(L, i); /* value to print */ |
| 39 | lua_call(L, 1, 1); |
| 40 | s = lua_tostring(L, -1); /* get result */ |
| 41 | if (s == NULL) |
| 42 | return luaL_error(L, LUA_QL("tostring") " must return a string to " |
| 43 | LUA_QL("print")); |
| 44 | if (i>1) fputs("\t", stdout); |
| 45 | fputs(s, stdout); |
| 46 | lua_pop(L, 1); /* pop result */ |
| 47 | } |
| 48 | fputs("\n", stdout); |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | static int luaB_tonumber (lua_State *L) { |
nothing calls this directly
no test coverage detected