39 if (std::is_integral<T>())
40 ret = lua_tointeger(L, -1);
42 ret = lua_tonumber(L, -1);
45 template <
typename T,
size_t N>
63 if (lua_isnumber(L, -1)) {
64 auto n = lua_tonumber(L, -1);
76 if (lua_isnumber(L, -1)) {
77 auto n = lua_tonumber(L, -1);
90 {(int)TweenStyle::fwd,
"fwd"},
91 {(int)TweenStyle::rev,
"rev"},
92 {(int)TweenStyle::pulse,
"pulse"},
93 {(int)TweenStyle::flicker,
"flicker"},
97 luaL_checktype(L, -1, LUA_TSTRING);
98 int v = (int)TweenStyle::fwd;
100 throw LuaError(
"tween style must be one of ('fwd', 'rev', 'pulse', 'flicker')");
107 if (lua_isnil(L, -1))
111 {(int)AttractorKind::none,
"none"},
112 {(int)AttractorKind::point,
"point"},
113 {(int)AttractorKind::line,
"line"},
114 {(int)AttractorKind::plane,
"plane"},
118 luaL_checktype(L, -1, LUA_TSTRING);
119 int v = (int)AttractorKind::none;
121 throw LuaError(
"attractor kind must be one of ('none', 'point', 'line', 'plane')");
128 if (lua_isnil(L, -1))
132 {(int)BlendMode::alpha,
"alpha"},
133 {(int)BlendMode::add,
"add"},
134 {(int)BlendMode::sub,
"sub"},
135 {(int)BlendMode::screen,
"screen"},
139 luaL_checktype(L, -1, LUA_TSTRING);
140 int v = (int)BlendMode::alpha;
142 throw LuaError(
"blend mode must be one of ('alpha', 'add', 'sub', 'screen')");
147 template <
typename T>
void
152 if (!lua_istable(L,-1))
155 lua_getfield(L, -1,
"min");
157 if (lua_isnil(L,-1)) {
164 lua_getfield(L, -1,
"max");
168 lua_getfield(L, -1,
"bias");
169 if (!lua_isnil(L,-1))
179 template <
typename T>
void
182 template <
typename T>
void
185 int tbl = lua_gettop(L);
186 lua_pushliteral(L,
"min");
187 lua_pushstring(L, name);
189 lua_gettable(L, tbl);
190 if (!lua_isnil(L, -1)) {
195 lua_pushliteral(L,
"max");
196 lua_pushstring(L, name);
198 lua_gettable(L, tbl);
199 if (!lua_isnil(L, -1)) {
205 template <
typename T>
void
208 int tbl = lua_gettop(L);
210 lua_pushstring(L, name);
211 lua_pushliteral(L,
"_tween");
213 lua_gettable(L, tbl);
214 if(lua_istable(L, -1)) {
215 int tween = lua_gettop(L);
217 lua_pushinteger(L, 1), lua_gettable(L, tween);
223 lua_pushinteger(L, (lua_Integer)lua_objlen(L, -1)), lua_gettable(L, tween);
228 lua_getfield(L, -1,
"style");
229 if (!lua_isnil(L,-1))
233 lua_getfield(L, -1,
"reps");
234 if (!lua_isnil(L,-1))
238 lua_getfield(L, -1,
"start");
239 if (!lua_isnil(L,-1))
249 lua_getfield(L, tbl, name);
250 if(!lua_isnil(L, -1)) {
271 lua_getfield(L, -1, name);
272 if (!lua_isnil(L, -1)) {
bool string_to_enum(const EnumString *spec, int &result, const std::string &str)
Definition c_content.cpp:1344
v2f check_v2f(lua_State *L, int index)
Definition c_converter.cpp:168
v3f check_v3f(lua_State *L, int index)
Definition c_converter.cpp:195
static T * checkObject(lua_State *L, int narg)
Definition l_base.h:83
static ServerActiveObject * getobject(ObjectRef *ref)
Definition l_object.cpp:49
Definition l_particleparams.h:30
void readNumericLuaValue(lua_State *L, T &ret)
Definition l_particleparams.h:34
u16 readAttachmentID(lua_State *L, const char *name)
Definition l_particleparams.h:268
void readTweenTable(lua_State *L, const char *name, TweenedParameter< T > &field)
Definition l_particleparams.h:206
void readTexValue(lua_State *L, ServerParticleTexture &tex)
Definition l_particles.cpp:29
void readLegacyValue(lua_State *L, const char *name, T &field)
Definition l_particleparams.h:180
void readLuaValue(lua_State *L, f32Parameter &ret)
Definition l_particleparams.h:53
Definition particles.cpp:123
VectorParameter< v3f, 3 > v3fParameter
Definition particles.h:147
TweenStyle
Definition particles.h:205
VectorParameter< v2f, 2 > v2fParameter
Definition particles.h:146
BlendMode
Definition particles.h:251
AttractorKind
Definition particles.h:250
Definition particles.h:90
T val
Definition particles.h:94
Definition particles.h:153
T max
Definition particles.h:157
f32 bias
Definition particles.h:158
T min
Definition particles.h:157
Definition particles.h:210
T start
Definition particles.h:218
f32 beginning
Definition particles.h:216
T end
Definition particles.h:218
u16 reps
Definition particles.h:215
TweenStyle style
Definition particles.h:214
Definition particles.h:125
Definition particles.h:277