lua_AnimationTarget.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_AnimationTarget.h"
  4. #include "Animation.h"
  5. #include "AnimationTarget.h"
  6. #include "Base.h"
  7. #include "Game.h"
  8. #include "Node.h"
  9. #include "lua_CurveInterpolationType.h"
  10. namespace gameplay
  11. {
  12. void luaRegister_AnimationTarget()
  13. {
  14. const luaL_Reg lua_members[] =
  15. {
  16. {"createAnimation", lua_AnimationTarget_createAnimation},
  17. {"createAnimationFromBy", lua_AnimationTarget_createAnimationFromBy},
  18. {"createAnimationFromTo", lua_AnimationTarget_createAnimationFromTo},
  19. {"destroyAnimation", lua_AnimationTarget_destroyAnimation},
  20. {"getAnimation", lua_AnimationTarget_getAnimation},
  21. {"getAnimationPropertyComponentCount", lua_AnimationTarget_getAnimationPropertyComponentCount},
  22. {"getAnimationPropertyValue", lua_AnimationTarget_getAnimationPropertyValue},
  23. {"setAnimationPropertyValue", lua_AnimationTarget_setAnimationPropertyValue},
  24. {NULL, NULL}
  25. };
  26. const luaL_Reg* lua_statics = NULL;
  27. std::vector<std::string> scopePath;
  28. ScriptUtil::registerClass("AnimationTarget", lua_members, NULL, NULL, lua_statics, scopePath);
  29. }
  30. static AnimationTarget* getInstance(lua_State* state)
  31. {
  32. void* userdata = luaL_checkudata(state, 1, "AnimationTarget");
  33. luaL_argcheck(state, userdata != NULL, 1, "'AnimationTarget' expected.");
  34. return (AnimationTarget*)((ScriptUtil::LuaObject*)userdata)->instance;
  35. }
  36. int lua_AnimationTarget_createAnimation(lua_State* state)
  37. {
  38. // Get the number of parameters.
  39. int paramCount = lua_gettop(state);
  40. // Attempt to match the parameters to a valid binding.
  41. switch (paramCount)
  42. {
  43. case 3:
  44. {
  45. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  46. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  47. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  48. {
  49. // Get parameter 1 off the stack.
  50. const char* param1 = ScriptUtil::getString(2, false);
  51. // Get parameter 2 off the stack.
  52. const char* param2 = ScriptUtil::getString(3, false);
  53. AnimationTarget* instance = getInstance(state);
  54. void* returnPtr = (void*)instance->createAnimation(param1, param2);
  55. if (returnPtr)
  56. {
  57. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  58. object->instance = returnPtr;
  59. object->owns = false;
  60. luaL_getmetatable(state, "Animation");
  61. lua_setmetatable(state, -2);
  62. }
  63. else
  64. {
  65. lua_pushnil(state);
  66. }
  67. return 1;
  68. }
  69. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  70. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  71. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  72. {
  73. // Get parameter 1 off the stack.
  74. const char* param1 = ScriptUtil::getString(2, false);
  75. // Get parameter 2 off the stack.
  76. Properties* param2 = ScriptUtil::getObjectPointer<Properties>(3, "Properties", false);
  77. AnimationTarget* instance = getInstance(state);
  78. void* returnPtr = (void*)instance->createAnimation(param1, param2);
  79. if (returnPtr)
  80. {
  81. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  82. object->instance = returnPtr;
  83. object->owns = false;
  84. luaL_getmetatable(state, "Animation");
  85. lua_setmetatable(state, -2);
  86. }
  87. else
  88. {
  89. lua_pushnil(state);
  90. }
  91. return 1;
  92. }
  93. else
  94. {
  95. lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
  96. lua_error(state);
  97. }
  98. break;
  99. }
  100. case 7:
  101. {
  102. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  103. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  104. lua_type(state, 3) == LUA_TNUMBER &&
  105. lua_type(state, 4) == LUA_TNUMBER &&
  106. (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
  107. (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
  108. (lua_type(state, 7) == LUA_TSTRING || lua_type(state, 7) == LUA_TNIL))
  109. {
  110. // Get parameter 1 off the stack.
  111. const char* param1 = ScriptUtil::getString(2, false);
  112. // Get parameter 2 off the stack.
  113. int param2 = (int)luaL_checkint(state, 3);
  114. // Get parameter 3 off the stack.
  115. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  116. // Get parameter 4 off the stack.
  117. unsigned long* param4 = ScriptUtil::getUnsignedLongPointer(5);
  118. // Get parameter 5 off the stack.
  119. float* param5 = ScriptUtil::getFloatPointer(6);
  120. // Get parameter 6 off the stack.
  121. Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
  122. AnimationTarget* instance = getInstance(state);
  123. void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
  124. if (returnPtr)
  125. {
  126. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  127. object->instance = returnPtr;
  128. object->owns = false;
  129. luaL_getmetatable(state, "Animation");
  130. lua_setmetatable(state, -2);
  131. }
  132. else
  133. {
  134. lua_pushnil(state);
  135. }
  136. return 1;
  137. }
  138. else
  139. {
  140. lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
  141. lua_error(state);
  142. }
  143. break;
  144. }
  145. case 9:
  146. {
  147. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  148. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  149. lua_type(state, 3) == LUA_TNUMBER &&
  150. lua_type(state, 4) == LUA_TNUMBER &&
  151. (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
  152. (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
  153. (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
  154. (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
  155. (lua_type(state, 9) == LUA_TSTRING || lua_type(state, 9) == LUA_TNIL))
  156. {
  157. // Get parameter 1 off the stack.
  158. const char* param1 = ScriptUtil::getString(2, false);
  159. // Get parameter 2 off the stack.
  160. int param2 = (int)luaL_checkint(state, 3);
  161. // Get parameter 3 off the stack.
  162. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
  163. // Get parameter 4 off the stack.
  164. unsigned long* param4 = ScriptUtil::getUnsignedLongPointer(5);
  165. // Get parameter 5 off the stack.
  166. float* param5 = ScriptUtil::getFloatPointer(6);
  167. // Get parameter 6 off the stack.
  168. float* param6 = ScriptUtil::getFloatPointer(7);
  169. // Get parameter 7 off the stack.
  170. float* param7 = ScriptUtil::getFloatPointer(8);
  171. // Get parameter 8 off the stack.
  172. Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
  173. AnimationTarget* instance = getInstance(state);
  174. void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
  175. if (returnPtr)
  176. {
  177. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  178. object->instance = returnPtr;
  179. object->owns = false;
  180. luaL_getmetatable(state, "Animation");
  181. lua_setmetatable(state, -2);
  182. }
  183. else
  184. {
  185. lua_pushnil(state);
  186. }
  187. return 1;
  188. }
  189. else
  190. {
  191. lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
  192. lua_error(state);
  193. }
  194. break;
  195. }
  196. default:
  197. {
  198. lua_pushstring(state, "Invalid number of parameters (expected 3, 7 or 9).");
  199. lua_error(state);
  200. break;
  201. }
  202. }
  203. return 0;
  204. }
  205. int lua_AnimationTarget_createAnimationFromBy(lua_State* state)
  206. {
  207. // Get the number of parameters.
  208. int paramCount = lua_gettop(state);
  209. // Attempt to match the parameters to a valid binding.
  210. switch (paramCount)
  211. {
  212. case 7:
  213. {
  214. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  215. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  216. lua_type(state, 3) == LUA_TNUMBER &&
  217. (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
  218. (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
  219. (lua_type(state, 6) == LUA_TSTRING || lua_type(state, 6) == LUA_TNIL) &&
  220. lua_type(state, 7) == LUA_TNUMBER)
  221. {
  222. // Get parameter 1 off the stack.
  223. const char* param1 = ScriptUtil::getString(2, false);
  224. // Get parameter 2 off the stack.
  225. int param2 = (int)luaL_checkint(state, 3);
  226. // Get parameter 3 off the stack.
  227. float* param3 = ScriptUtil::getFloatPointer(4);
  228. // Get parameter 4 off the stack.
  229. float* param4 = ScriptUtil::getFloatPointer(5);
  230. // Get parameter 5 off the stack.
  231. Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
  232. // Get parameter 6 off the stack.
  233. unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
  234. AnimationTarget* instance = getInstance(state);
  235. void* returnPtr = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
  236. if (returnPtr)
  237. {
  238. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  239. object->instance = returnPtr;
  240. object->owns = false;
  241. luaL_getmetatable(state, "Animation");
  242. lua_setmetatable(state, -2);
  243. }
  244. else
  245. {
  246. lua_pushnil(state);
  247. }
  248. return 1;
  249. }
  250. else
  251. {
  252. lua_pushstring(state, "lua_AnimationTarget_createAnimationFromBy - Failed to match the given parameters to a valid function signature.");
  253. lua_error(state);
  254. }
  255. break;
  256. }
  257. default:
  258. {
  259. lua_pushstring(state, "Invalid number of parameters (expected 7).");
  260. lua_error(state);
  261. break;
  262. }
  263. }
  264. return 0;
  265. }
  266. int lua_AnimationTarget_createAnimationFromTo(lua_State* state)
  267. {
  268. // Get the number of parameters.
  269. int paramCount = lua_gettop(state);
  270. // Attempt to match the parameters to a valid binding.
  271. switch (paramCount)
  272. {
  273. case 7:
  274. {
  275. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  276. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  277. lua_type(state, 3) == LUA_TNUMBER &&
  278. (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
  279. (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
  280. (lua_type(state, 6) == LUA_TSTRING || lua_type(state, 6) == LUA_TNIL) &&
  281. lua_type(state, 7) == LUA_TNUMBER)
  282. {
  283. // Get parameter 1 off the stack.
  284. const char* param1 = ScriptUtil::getString(2, false);
  285. // Get parameter 2 off the stack.
  286. int param2 = (int)luaL_checkint(state, 3);
  287. // Get parameter 3 off the stack.
  288. float* param3 = ScriptUtil::getFloatPointer(4);
  289. // Get parameter 4 off the stack.
  290. float* param4 = ScriptUtil::getFloatPointer(5);
  291. // Get parameter 5 off the stack.
  292. Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
  293. // Get parameter 6 off the stack.
  294. unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
  295. AnimationTarget* instance = getInstance(state);
  296. void* returnPtr = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
  297. if (returnPtr)
  298. {
  299. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  300. object->instance = returnPtr;
  301. object->owns = false;
  302. luaL_getmetatable(state, "Animation");
  303. lua_setmetatable(state, -2);
  304. }
  305. else
  306. {
  307. lua_pushnil(state);
  308. }
  309. return 1;
  310. }
  311. else
  312. {
  313. lua_pushstring(state, "lua_AnimationTarget_createAnimationFromTo - Failed to match the given parameters to a valid function signature.");
  314. lua_error(state);
  315. }
  316. break;
  317. }
  318. default:
  319. {
  320. lua_pushstring(state, "Invalid number of parameters (expected 7).");
  321. lua_error(state);
  322. break;
  323. }
  324. }
  325. return 0;
  326. }
  327. int lua_AnimationTarget_destroyAnimation(lua_State* state)
  328. {
  329. // Get the number of parameters.
  330. int paramCount = lua_gettop(state);
  331. // Attempt to match the parameters to a valid binding.
  332. switch (paramCount)
  333. {
  334. case 1:
  335. {
  336. if ((lua_type(state, 1) == LUA_TUSERDATA))
  337. {
  338. AnimationTarget* instance = getInstance(state);
  339. instance->destroyAnimation();
  340. return 0;
  341. }
  342. else
  343. {
  344. lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
  345. lua_error(state);
  346. }
  347. break;
  348. }
  349. case 2:
  350. {
  351. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  352. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  353. {
  354. // Get parameter 1 off the stack.
  355. const char* param1 = ScriptUtil::getString(2, false);
  356. AnimationTarget* instance = getInstance(state);
  357. instance->destroyAnimation(param1);
  358. return 0;
  359. }
  360. else
  361. {
  362. lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
  363. lua_error(state);
  364. }
  365. break;
  366. }
  367. default:
  368. {
  369. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  370. lua_error(state);
  371. break;
  372. }
  373. }
  374. return 0;
  375. }
  376. int lua_AnimationTarget_getAnimation(lua_State* state)
  377. {
  378. // Get the number of parameters.
  379. int paramCount = lua_gettop(state);
  380. // Attempt to match the parameters to a valid binding.
  381. switch (paramCount)
  382. {
  383. case 1:
  384. {
  385. if ((lua_type(state, 1) == LUA_TUSERDATA))
  386. {
  387. AnimationTarget* instance = getInstance(state);
  388. void* returnPtr = (void*)instance->getAnimation();
  389. if (returnPtr)
  390. {
  391. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  392. object->instance = returnPtr;
  393. object->owns = false;
  394. luaL_getmetatable(state, "Animation");
  395. lua_setmetatable(state, -2);
  396. }
  397. else
  398. {
  399. lua_pushnil(state);
  400. }
  401. return 1;
  402. }
  403. else
  404. {
  405. lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
  406. lua_error(state);
  407. }
  408. break;
  409. }
  410. case 2:
  411. {
  412. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  413. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  414. {
  415. // Get parameter 1 off the stack.
  416. const char* param1 = ScriptUtil::getString(2, false);
  417. AnimationTarget* instance = getInstance(state);
  418. void* returnPtr = (void*)instance->getAnimation(param1);
  419. if (returnPtr)
  420. {
  421. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  422. object->instance = returnPtr;
  423. object->owns = false;
  424. luaL_getmetatable(state, "Animation");
  425. lua_setmetatable(state, -2);
  426. }
  427. else
  428. {
  429. lua_pushnil(state);
  430. }
  431. return 1;
  432. }
  433. else
  434. {
  435. lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
  436. lua_error(state);
  437. }
  438. break;
  439. }
  440. default:
  441. {
  442. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  443. lua_error(state);
  444. break;
  445. }
  446. }
  447. return 0;
  448. }
  449. int lua_AnimationTarget_getAnimationPropertyComponentCount(lua_State* state)
  450. {
  451. // Get the number of parameters.
  452. int paramCount = lua_gettop(state);
  453. // Attempt to match the parameters to a valid binding.
  454. switch (paramCount)
  455. {
  456. case 2:
  457. {
  458. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  459. lua_type(state, 2) == LUA_TNUMBER)
  460. {
  461. // Get parameter 1 off the stack.
  462. int param1 = (int)luaL_checkint(state, 2);
  463. AnimationTarget* instance = getInstance(state);
  464. unsigned int result = instance->getAnimationPropertyComponentCount(param1);
  465. // Push the return value onto the stack.
  466. lua_pushunsigned(state, result);
  467. return 1;
  468. }
  469. else
  470. {
  471. lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyComponentCount - Failed to match the given parameters to a valid function signature.");
  472. lua_error(state);
  473. }
  474. break;
  475. }
  476. default:
  477. {
  478. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  479. lua_error(state);
  480. break;
  481. }
  482. }
  483. return 0;
  484. }
  485. int lua_AnimationTarget_getAnimationPropertyValue(lua_State* state)
  486. {
  487. // Get the number of parameters.
  488. int paramCount = lua_gettop(state);
  489. // Attempt to match the parameters to a valid binding.
  490. switch (paramCount)
  491. {
  492. case 3:
  493. {
  494. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  495. lua_type(state, 2) == LUA_TNUMBER &&
  496. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  497. {
  498. // Get parameter 1 off the stack.
  499. int param1 = (int)luaL_checkint(state, 2);
  500. // Get parameter 2 off the stack.
  501. AnimationValue* param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
  502. AnimationTarget* instance = getInstance(state);
  503. instance->getAnimationPropertyValue(param1, param2);
  504. return 0;
  505. }
  506. else
  507. {
  508. lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
  509. lua_error(state);
  510. }
  511. break;
  512. }
  513. default:
  514. {
  515. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  516. lua_error(state);
  517. break;
  518. }
  519. }
  520. return 0;
  521. }
  522. int lua_AnimationTarget_setAnimationPropertyValue(lua_State* state)
  523. {
  524. // Get the number of parameters.
  525. int paramCount = lua_gettop(state);
  526. // Attempt to match the parameters to a valid binding.
  527. switch (paramCount)
  528. {
  529. case 3:
  530. {
  531. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  532. lua_type(state, 2) == LUA_TNUMBER &&
  533. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  534. {
  535. // Get parameter 1 off the stack.
  536. int param1 = (int)luaL_checkint(state, 2);
  537. // Get parameter 2 off the stack.
  538. AnimationValue* param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
  539. AnimationTarget* instance = getInstance(state);
  540. instance->setAnimationPropertyValue(param1, param2);
  541. return 0;
  542. }
  543. else
  544. {
  545. lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
  546. lua_error(state);
  547. }
  548. break;
  549. }
  550. case 4:
  551. {
  552. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  553. lua_type(state, 2) == LUA_TNUMBER &&
  554. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
  555. lua_type(state, 4) == LUA_TNUMBER)
  556. {
  557. // Get parameter 1 off the stack.
  558. int param1 = (int)luaL_checkint(state, 2);
  559. // Get parameter 2 off the stack.
  560. AnimationValue* param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
  561. // Get parameter 3 off the stack.
  562. float param3 = (float)luaL_checknumber(state, 4);
  563. AnimationTarget* instance = getInstance(state);
  564. instance->setAnimationPropertyValue(param1, param2, param3);
  565. return 0;
  566. }
  567. else
  568. {
  569. lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
  570. lua_error(state);
  571. }
  572. break;
  573. }
  574. default:
  575. {
  576. lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
  577. lua_error(state);
  578. break;
  579. }
  580. }
  581. return 0;
  582. }
  583. }