| 1585 | |
| 1586 | |
| 1587 | int LuaCallOuts::DiffTimers(lua_State* L) { |
| 1588 | const int args = lua_gettop(L); // number of arguments |
| 1589 | if ((args != 2) || !lua_isuserdata(L, 1) || !lua_isuserdata(L, 2)) { |
| 1590 | luaL_error(L, "Incorrect arguments to DiffTimers()"); |
| 1591 | } |
| 1592 | const char* p1 = (char*) lua_touserdata(L, 1); |
| 1593 | const char* p2 = (char*) lua_touserdata(L, 2); |
| 1594 | const uint32_t t1 = uint32_t(p1 - (char*)0); |
| 1595 | const uint32_t t2 = uint32_t(p2 - (char*)0); |
| 1596 | const uint32_t diffTime = (t1 - t2); |
| 1597 | lua_pushfloat(L, float(diffTime) * 0.001f); // return seconds |
| 1598 | return 1; |
| 1599 | } |
| 1600 | |
| 1601 | |
| 1602 | //============================================================================// |
nothing calls this directly
no test coverage detected