zapper.set(table state) Sets the zapper state for the next frame advance.
| 2784 | // |
| 2785 | // Sets the zapper state for the next frame advance. |
| 2786 | static int zapper_set(lua_State* L) { |
| 2787 | |
| 2788 | luaL_checktype(L, 1, LUA_TTABLE); |
| 2789 | |
| 2790 | luazapperx = -1; |
| 2791 | luazappery = -1; |
| 2792 | luazapperfire = -1; |
| 2793 | |
| 2794 | lua_getfield(L, 1, "x"); |
| 2795 | if (!lua_isnil(L, -1)) luazapperx = lua_tointeger(L, -1); |
| 2796 | lua_pop(L, 1); |
| 2797 | |
| 2798 | lua_getfield(L, 1, "y"); |
| 2799 | if (!lua_isnil(L, -1)) luazappery = lua_tointeger(L, -1); |
| 2800 | lua_pop(L, 1); |
| 2801 | |
| 2802 | lua_getfield(L, 1, "fire"); |
| 2803 | if (!lua_isnil(L, -1)) |
| 2804 | { |
| 2805 | if (lua_toboolean(L, -1)) // True or string |
| 2806 | luazapperfire = 1; |
| 2807 | if (lua_toboolean(L, -1) == 0 || lua_isstring(L, -1)) // False or string |
| 2808 | luazapperfire = 0; |
| 2809 | } |
| 2810 | lua_pop(L, 1); |
| 2811 | |
| 2812 | return 0; |
| 2813 | } |
| 2814 | |
| 2815 | // table joypad.read(int which = 1) |
| 2816 | // |
nothing calls this directly
no test coverage detected