MCPcopy Create free account
hub / github.com/defold/defold / InitializeScript

Function InitializeScript

engine/gameobject/src/gameobject/gameobject_script.cpp:2224–2304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2222 };
2223
2224 void InitializeScript(HRegister regist, dmScript::HContext context)
2225 {
2226 g_Register = regist;
2227
2228 lua_State* L = dmScript::GetLuaState(context);
2229
2230 int top = lua_gettop(L);
2231 (void)top;
2232
2233 SCRIPT_TYPE_HASH = dmScript::RegisterUserType(L, SCRIPT, Script_methods, Script_meta);
2234
2235 SCRIPTINSTANCE_TYPE_HASH = dmScript::RegisterUserType(L, SCRIPTINSTANCE, ScriptInstance_methods, ScriptInstance_meta);
2236
2237 luaL_register(L, "go", GO_methods);
2238
2239#define SETPLAYBACK(name) \
2240 lua_pushnumber(L, (lua_Number) PLAYBACK_##name); \
2241 lua_setfield(L, -2, "PLAYBACK_"#name);\
2242
2243 SETPLAYBACK(NONE)
2244 SETPLAYBACK(ONCE_FORWARD)
2245 SETPLAYBACK(ONCE_BACKWARD)
2246 SETPLAYBACK(ONCE_PINGPONG)
2247 SETPLAYBACK(LOOP_FORWARD)
2248 SETPLAYBACK(LOOP_BACKWARD)
2249 SETPLAYBACK(LOOP_PINGPONG)
2250
2251#undef SETPLAYBACK
2252
2253#define SETEASING(name) \
2254 lua_pushnumber(L, (lua_Number) dmEasing::TYPE_##name); \
2255 lua_setfield(L, -2, "EASING_"#name);\
2256
2257 SETEASING(LINEAR)
2258 SETEASING(INQUAD)
2259 SETEASING(OUTQUAD)
2260 SETEASING(INOUTQUAD)
2261 SETEASING(OUTINQUAD)
2262 SETEASING(INCUBIC)
2263 SETEASING(OUTCUBIC)
2264 SETEASING(INOUTCUBIC)
2265 SETEASING(OUTINCUBIC)
2266 SETEASING(INQUART)
2267 SETEASING(OUTQUART)
2268 SETEASING(INOUTQUART)
2269 SETEASING(OUTINQUART)
2270 SETEASING(INQUINT)
2271 SETEASING(OUTQUINT)
2272 SETEASING(INOUTQUINT)
2273 SETEASING(OUTINQUINT)
2274 SETEASING(INSINE)
2275 SETEASING(OUTSINE)
2276 SETEASING(INOUTSINE)
2277 SETEASING(OUTINSINE)
2278 SETEASING(INEXPO)
2279 SETEASING(OUTEXPO)
2280 SETEASING(INOUTEXPO)
2281 SETEASING(OUTINEXPO)

Callers 2

InitializeFunction · 0.70
CompGuiTypeCreateFunction · 0.50

Calls 4

lua_gettopFunction · 0.85
RegisterUserTypeFunction · 0.85
GetLuaStateFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected