23 if (std::is_integral<T>())
24 ret = lua_tointeger(L, -1);
26 ret = lua_tonumber(L, -1);
29 template <
typename T,
size_t N>
47 if (lua_isnumber(L, -1)) {
48 auto n = lua_tonumber(L, -1);
60 if (lua_isnumber(L, -1)) {
61 auto n = lua_tonumber(L, -1);
74 {(int)TweenStyle::fwd,
"fwd"},
75 {(int)TweenStyle::rev,
"rev"},
76 {(int)TweenStyle::pulse,
"pulse"},
77 {(int)TweenStyle::flicker,
"flicker"},
81 luaL_checktype(L, -1, LUA_TSTRING);
82 int v = (int)TweenStyle::fwd;
84 throw LuaError(
"tween style must be one of ('fwd', 'rev', 'pulse', 'flicker')");
95 {(int)AttractorKind::none,
"none"},
96 {(int)AttractorKind::point,
"point"},
97 {(int)AttractorKind::line,
"line"},
98 {(int)AttractorKind::plane,
"plane"},
102 luaL_checktype(L, -1, LUA_TSTRING);
103 int v = (int)AttractorKind::none;
105 throw LuaError(
"attractor kind must be one of ('none', 'point', 'line', 'plane')");
112 if (lua_isnil(L, -1))
116 {(int)BlendMode::alpha,
"alpha"},
117 {(int)BlendMode::add,
"add"},
118 {(int)BlendMode::sub,
"sub"},
119 {(int)BlendMode::screen,
"screen"},
120 {(int)BlendMode::clip,
"clip"},
124 luaL_checktype(L, -1, LUA_TSTRING);
125 int v = (int)BlendMode::alpha;
127 throw LuaError(
"blend mode must be one of ('alpha', 'clip', 'add', 'sub', 'screen')");
132 template <
typename T>
void
137 if (!lua_istable(L,-1))
140 lua_getfield(L, -1,
"min");
142 if (lua_isnil(L,-1)) {
149 lua_getfield(L, -1,
"max");
153 lua_getfield(L, -1,
"bias");
154 if (!lua_isnil(L,-1))
164 template <
typename T>
void
167 template <
typename T>
void
170 int tbl = lua_gettop(L);
171 lua_pushliteral(L,
"min");
172 lua_pushstring(L, name);
174 lua_gettable(L, tbl);
175 if (!lua_isnil(L, -1)) {
180 lua_pushliteral(L,
"max");
181 lua_pushstring(L, name);
183 lua_gettable(L, tbl);
184 if (!lua_isnil(L, -1)) {
190 template <
typename T>
void
193 int tbl = lua_gettop(L);
195 lua_pushstring(L, name);
196 lua_pushliteral(L,
"_tween");
198 lua_gettable(L, tbl);
199 if(lua_istable(L, -1)) {
200 int tween = lua_gettop(L);
202 lua_pushinteger(L, 1), lua_gettable(L, tween);
208 lua_pushinteger(L, (lua_Integer)lua_objlen(L, -1)), lua_gettable(L, tween);
213 lua_getfield(L, -1,
"style");
214 if (!lua_isnil(L,-1))
218 lua_getfield(L, -1,
"reps");
219 if (!lua_isnil(L,-1))
223 lua_getfield(L, -1,
"start");
224 if (!lua_isnil(L,-1))
234 lua_getfield(L, tbl, name);
235 if(!lua_isnil(L, -1)) {
256 lua_getfield(L, -1, name);
257 if (!lua_isnil(L, -1)) {
v2f check_v2f(lua_State *L, int index)
Definition c_converter.cpp:154
v3f check_v3f(lua_State *L, int index)
Definition c_converter.cpp:176
static T * checkObject(lua_State *L, int narg)
Definition l_base.h:95
static ServerActiveObject * getobject(ObjectRef *ref)
Definition l_object.cpp:34
bool string_to_enum(const EnumString *spec, int &result, std::string_view str)
Definition enum_string.cpp:8
Definition l_particleparams.h:14
void readNumericLuaValue(lua_State *L, T &ret)
Definition l_particleparams.h:18
u16 readAttachmentID(lua_State *L, const char *name)
Definition l_particleparams.h:253
void readTweenTable(lua_State *L, const char *name, TweenedParameter< T > &field)
Definition l_particleparams.h:191
void readTexValue(lua_State *L, ServerParticleTexture &tex)
Definition l_particles.cpp:15
void readLegacyValue(lua_State *L, const char *name, T &field)
Definition l_particleparams.h:165
void readLuaValue(lua_State *L, f32Parameter &ret)
Definition l_particleparams.h:37
Definition particles.cpp:110
VectorParameter< v3f, 3 > v3fParameter
Definition particles.h:123
TweenStyle
Definition particles.h:181
VectorParameter< v2f, 2 > v2fParameter
Definition particles.h:122
BlendMode
Definition particles.h:228
AttractorKind
Definition particles.h:226
Definition enum_string.h:11
Definition particles.h:66
T val
Definition particles.h:70
Definition particles.h:129
T max
Definition particles.h:133
f32 bias
Definition particles.h:134
T min
Definition particles.h:133
Definition particles.h:186
T start
Definition particles.h:194
f32 beginning
Definition particles.h:192
T end
Definition particles.h:194
u16 reps
Definition particles.h:191
TweenStyle style
Definition particles.h:190
Definition particles.h:101
Definition particles.h:254