24 if (std::is_integral<T>())
25 ret = lua_tointeger(L, -1);
27 ret = lua_tonumber(L, -1);
30 template <
typename T,
size_t N>
48 if (lua_isnumber(L, -1)) {
49 auto n = lua_tonumber(L, -1);
61 if (lua_isnumber(L, -1)) {
62 auto n = lua_tonumber(L, -1);
75 {(int)TweenStyle::fwd,
"fwd"},
76 {(int)TweenStyle::rev,
"rev"},
77 {(int)TweenStyle::pulse,
"pulse"},
78 {(int)TweenStyle::flicker,
"flicker"},
82 luaL_checktype(L, -1, LUA_TSTRING);
83 int v = (int)TweenStyle::fwd;
85 throw LuaError(
"tween style must be one of ('fwd', 'rev', 'pulse', 'flicker')");
96 {(int)AttractorKind::none,
"none"},
97 {(int)AttractorKind::point,
"point"},
98 {(int)AttractorKind::line,
"line"},
99 {(int)AttractorKind::plane,
"plane"},
103 luaL_checktype(L, -1, LUA_TSTRING);
104 int v = (int)AttractorKind::none;
106 throw LuaError(
"attractor kind must be one of ('none', 'point', 'line', 'plane')");
113 if (lua_isnil(L, -1))
117 {(int)BlendMode::alpha,
"alpha"},
118 {(int)BlendMode::add,
"add"},
119 {(int)BlendMode::sub,
"sub"},
120 {(int)BlendMode::screen,
"screen"},
121 {(int)BlendMode::clip,
"clip"},
125 luaL_checktype(L, -1, LUA_TSTRING);
126 int v = (int)BlendMode::alpha;
128 throw LuaError(
"blend mode must be one of ('alpha', 'clip', 'add', 'sub', 'screen')");
133 template <
typename T>
void
138 if (!lua_istable(L,-1))
141 lua_getfield(L, -1,
"min");
143 if (lua_isnil(L,-1)) {
150 lua_getfield(L, -1,
"max");
154 lua_getfield(L, -1,
"bias");
155 if (!lua_isnil(L,-1))
165 template <
typename T>
void
168 template <
typename T>
void
171 int tbl = lua_gettop(L);
172 lua_pushliteral(L,
"min");
173 lua_pushstring(L, name);
175 lua_gettable(L, tbl);
176 if (!lua_isnil(L, -1)) {
181 lua_pushliteral(L,
"max");
182 lua_pushstring(L, name);
184 lua_gettable(L, tbl);
185 if (!lua_isnil(L, -1)) {
191 template <
typename T>
void
194 int tbl = lua_gettop(L);
196 lua_pushstring(L, name);
197 lua_pushliteral(L,
"_tween");
199 lua_gettable(L, tbl);
200 if(lua_istable(L, -1)) {
201 int tween = lua_gettop(L);
203 lua_pushinteger(L, 1), lua_gettable(L, tween);
209 lua_pushinteger(L, (lua_Integer)lua_objlen(L, -1)), lua_gettable(L, tween);
214 lua_getfield(L, -1,
"style");
215 if (!lua_isnil(L,-1))
219 lua_getfield(L, -1,
"reps");
220 if (!lua_isnil(L,-1))
224 lua_getfield(L, -1,
"start");
225 if (!lua_isnil(L,-1))
235 lua_getfield(L, tbl, name);
236 if(!lua_isnil(L, -1)) {
257 lua_getfield(L, -1, name);
258 if (!lua_isnil(L, -1)) {
bool string_to_enum(const EnumString *spec, int &result, const std::string &str)
Definition c_content.cpp:1329
v2f check_v2f(lua_State *L, int index)
Definition c_converter.cpp:153
v3f check_v3f(lua_State *L, int index)
Definition c_converter.cpp:180
static T * checkObject(lua_State *L, int narg)
Definition l_base.h:68
static ServerActiveObject * getobject(ObjectRef *ref)
Definition l_object.cpp:34
Definition l_particleparams.h:15
void readNumericLuaValue(lua_State *L, T &ret)
Definition l_particleparams.h:19
u16 readAttachmentID(lua_State *L, const char *name)
Definition l_particleparams.h:254
void readTweenTable(lua_State *L, const char *name, TweenedParameter< T > &field)
Definition l_particleparams.h:192
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:166
void readLuaValue(lua_State *L, f32Parameter &ret)
Definition l_particleparams.h:38
Definition particles.cpp:108
VectorParameter< v3f, 3 > v3fParameter
Definition particles.h:132
TweenStyle
Definition particles.h:190
VectorParameter< v2f, 2 > v2fParameter
Definition particles.h:131
BlendMode
Definition particles.h:237
AttractorKind
Definition particles.h:235
Definition particles.h:75
T val
Definition particles.h:79
Definition particles.h:138
T max
Definition particles.h:142
f32 bias
Definition particles.h:143
T min
Definition particles.h:142
Definition particles.h:195
T start
Definition particles.h:203
f32 beginning
Definition particles.h:201
T end
Definition particles.h:203
u16 reps
Definition particles.h:200
TweenStyle style
Definition particles.h:199
Definition particles.h:110
Definition particles.h:263