1/**
2 * Copyright (c) 2006-2023 LOVE Development Team
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 **/
20
21#include "wrap_RopeJoint.h"
22
23namespace love
24{
25namespace physics
26{
27namespace box2d
28{
29
30RopeJoint *luax_checkropejoint(lua_State *L, int idx)
31{
32 RopeJoint *j = luax_checktype<RopeJoint>(L, idx);
33 if (!j->isValid())
34 luaL_error(L, "Attempt to use destroyed joint.");
35 return j;
36}
37
38int w_RopeJoint_getMaxLength(lua_State *L)
39{
40 RopeJoint *t = luax_checkropejoint(L, 1);
41 lua_pushnumber(L, t->getMaxLength());
42 return 1;
43}
44
45int w_RopeJoint_setMaxLength(lua_State *L)
46{
47 RopeJoint *t = luax_checkropejoint(L, 1);
48 float arg1 = (float)luaL_checknumber(L, 2);
49 t->setMaxLength(arg1);
50 return 0;
51}
52
53static const luaL_Reg w_RopeJoint_functions[] =
54{
55 { "getMaxLength", w_RopeJoint_getMaxLength },
56 { "setMaxLength", w_RopeJoint_setMaxLength },
57 { 0, 0 }
58};
59
60extern "C" int luaopen_ropejoint(lua_State *L)
61{
62 return luax_register_type(L, &RopeJoint::type, w_Joint_functions, w_RopeJoint_functions, nullptr);
63}
64
65} // box2d
66} // physics
67} // love
68