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"},
124 luaL_checktype(L, -1, LUA_TSTRING);
125 int v = (int)BlendMode::alpha;
127 throw LuaError(
"blend mode must be one of ('alpha', '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)) {
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: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:14
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: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:236
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:262