lua_AIMessage.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. // Autogenerated by gameplay-luagen
  2. #include "Base.h"
  3. #include "ScriptController.h"
  4. #include "lua_AIMessage.h"
  5. #include "AIMessage.h"
  6. #include "Base.h"
  7. namespace gameplay
  8. {
  9. void luaRegister_AIMessage()
  10. {
  11. const luaL_Reg lua_members[] =
  12. {
  13. {"getBoolean", lua_AIMessage_getBoolean},
  14. {"getDouble", lua_AIMessage_getDouble},
  15. {"getFloat", lua_AIMessage_getFloat},
  16. {"getId", lua_AIMessage_getId},
  17. {"getInt", lua_AIMessage_getInt},
  18. {"getLong", lua_AIMessage_getLong},
  19. {"getParameterCount", lua_AIMessage_getParameterCount},
  20. {"getParameterType", lua_AIMessage_getParameterType},
  21. {"getReceiver", lua_AIMessage_getReceiver},
  22. {"getSender", lua_AIMessage_getSender},
  23. {"getString", lua_AIMessage_getString},
  24. {"setBoolean", lua_AIMessage_setBoolean},
  25. {"setDouble", lua_AIMessage_setDouble},
  26. {"setFloat", lua_AIMessage_setFloat},
  27. {"setInt", lua_AIMessage_setInt},
  28. {"setLong", lua_AIMessage_setLong},
  29. {"setString", lua_AIMessage_setString},
  30. {NULL, NULL}
  31. };
  32. const luaL_Reg lua_statics[] =
  33. {
  34. {"create", lua_AIMessage_static_create},
  35. {"destroy", lua_AIMessage_static_destroy},
  36. {NULL, NULL}
  37. };
  38. std::vector<std::string> scopePath;
  39. gameplay::ScriptUtil::registerClass("AIMessage", lua_members, NULL, NULL, lua_statics, scopePath);
  40. }
  41. static AIMessage* getInstance(lua_State* state)
  42. {
  43. void* userdata = luaL_checkudata(state, 1, "AIMessage");
  44. luaL_argcheck(state, userdata != NULL, 1, "'AIMessage' expected.");
  45. return (AIMessage*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  46. }
  47. int lua_AIMessage_getBoolean(lua_State* state)
  48. {
  49. // Get the number of parameters.
  50. int paramCount = lua_gettop(state);
  51. // Attempt to match the parameters to a valid binding.
  52. switch (paramCount)
  53. {
  54. case 2:
  55. {
  56. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  57. lua_type(state, 2) == LUA_TNUMBER)
  58. {
  59. // Get parameter 1 off the stack.
  60. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  61. AIMessage* instance = getInstance(state);
  62. bool result = instance->getBoolean(param1);
  63. // Push the return value onto the stack.
  64. lua_pushboolean(state, result);
  65. return 1;
  66. }
  67. lua_pushstring(state, "lua_AIMessage_getBoolean - Failed to match the given parameters to a valid function signature.");
  68. lua_error(state);
  69. break;
  70. }
  71. default:
  72. {
  73. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  74. lua_error(state);
  75. break;
  76. }
  77. }
  78. return 0;
  79. }
  80. int lua_AIMessage_getDouble(lua_State* state)
  81. {
  82. // Get the number of parameters.
  83. int paramCount = lua_gettop(state);
  84. // Attempt to match the parameters to a valid binding.
  85. switch (paramCount)
  86. {
  87. case 2:
  88. {
  89. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  90. lua_type(state, 2) == LUA_TNUMBER)
  91. {
  92. // Get parameter 1 off the stack.
  93. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  94. AIMessage* instance = getInstance(state);
  95. double result = instance->getDouble(param1);
  96. // Push the return value onto the stack.
  97. lua_pushnumber(state, result);
  98. return 1;
  99. }
  100. lua_pushstring(state, "lua_AIMessage_getDouble - Failed to match the given parameters to a valid function signature.");
  101. lua_error(state);
  102. break;
  103. }
  104. default:
  105. {
  106. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  107. lua_error(state);
  108. break;
  109. }
  110. }
  111. return 0;
  112. }
  113. int lua_AIMessage_getFloat(lua_State* state)
  114. {
  115. // Get the number of parameters.
  116. int paramCount = lua_gettop(state);
  117. // Attempt to match the parameters to a valid binding.
  118. switch (paramCount)
  119. {
  120. case 2:
  121. {
  122. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  123. lua_type(state, 2) == LUA_TNUMBER)
  124. {
  125. // Get parameter 1 off the stack.
  126. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  127. AIMessage* instance = getInstance(state);
  128. float result = instance->getFloat(param1);
  129. // Push the return value onto the stack.
  130. lua_pushnumber(state, result);
  131. return 1;
  132. }
  133. lua_pushstring(state, "lua_AIMessage_getFloat - Failed to match the given parameters to a valid function signature.");
  134. lua_error(state);
  135. break;
  136. }
  137. default:
  138. {
  139. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  140. lua_error(state);
  141. break;
  142. }
  143. }
  144. return 0;
  145. }
  146. int lua_AIMessage_getId(lua_State* state)
  147. {
  148. // Get the number of parameters.
  149. int paramCount = lua_gettop(state);
  150. // Attempt to match the parameters to a valid binding.
  151. switch (paramCount)
  152. {
  153. case 1:
  154. {
  155. if ((lua_type(state, 1) == LUA_TUSERDATA))
  156. {
  157. AIMessage* instance = getInstance(state);
  158. unsigned int result = instance->getId();
  159. // Push the return value onto the stack.
  160. lua_pushunsigned(state, result);
  161. return 1;
  162. }
  163. lua_pushstring(state, "lua_AIMessage_getId - Failed to match the given parameters to a valid function signature.");
  164. lua_error(state);
  165. break;
  166. }
  167. default:
  168. {
  169. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  170. lua_error(state);
  171. break;
  172. }
  173. }
  174. return 0;
  175. }
  176. int lua_AIMessage_getInt(lua_State* state)
  177. {
  178. // Get the number of parameters.
  179. int paramCount = lua_gettop(state);
  180. // Attempt to match the parameters to a valid binding.
  181. switch (paramCount)
  182. {
  183. case 2:
  184. {
  185. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  186. lua_type(state, 2) == LUA_TNUMBER)
  187. {
  188. // Get parameter 1 off the stack.
  189. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  190. AIMessage* instance = getInstance(state);
  191. int result = instance->getInt(param1);
  192. // Push the return value onto the stack.
  193. lua_pushinteger(state, result);
  194. return 1;
  195. }
  196. lua_pushstring(state, "lua_AIMessage_getInt - Failed to match the given parameters to a valid function signature.");
  197. lua_error(state);
  198. break;
  199. }
  200. default:
  201. {
  202. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  203. lua_error(state);
  204. break;
  205. }
  206. }
  207. return 0;
  208. }
  209. int lua_AIMessage_getLong(lua_State* state)
  210. {
  211. // Get the number of parameters.
  212. int paramCount = lua_gettop(state);
  213. // Attempt to match the parameters to a valid binding.
  214. switch (paramCount)
  215. {
  216. case 2:
  217. {
  218. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  219. lua_type(state, 2) == LUA_TNUMBER)
  220. {
  221. // Get parameter 1 off the stack.
  222. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  223. AIMessage* instance = getInstance(state);
  224. long result = instance->getLong(param1);
  225. // Push the return value onto the stack.
  226. lua_pushinteger(state, result);
  227. return 1;
  228. }
  229. lua_pushstring(state, "lua_AIMessage_getLong - Failed to match the given parameters to a valid function signature.");
  230. lua_error(state);
  231. break;
  232. }
  233. default:
  234. {
  235. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  236. lua_error(state);
  237. break;
  238. }
  239. }
  240. return 0;
  241. }
  242. int lua_AIMessage_getParameterCount(lua_State* state)
  243. {
  244. // Get the number of parameters.
  245. int paramCount = lua_gettop(state);
  246. // Attempt to match the parameters to a valid binding.
  247. switch (paramCount)
  248. {
  249. case 1:
  250. {
  251. if ((lua_type(state, 1) == LUA_TUSERDATA))
  252. {
  253. AIMessage* instance = getInstance(state);
  254. unsigned int result = instance->getParameterCount();
  255. // Push the return value onto the stack.
  256. lua_pushunsigned(state, result);
  257. return 1;
  258. }
  259. lua_pushstring(state, "lua_AIMessage_getParameterCount - Failed to match the given parameters to a valid function signature.");
  260. lua_error(state);
  261. break;
  262. }
  263. default:
  264. {
  265. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  266. lua_error(state);
  267. break;
  268. }
  269. }
  270. return 0;
  271. }
  272. int lua_AIMessage_getParameterType(lua_State* state)
  273. {
  274. // Get the number of parameters.
  275. int paramCount = lua_gettop(state);
  276. // Attempt to match the parameters to a valid binding.
  277. switch (paramCount)
  278. {
  279. case 2:
  280. {
  281. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  282. lua_type(state, 2) == LUA_TNUMBER)
  283. {
  284. // Get parameter 1 off the stack.
  285. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  286. AIMessage* instance = getInstance(state);
  287. AIMessage::ParameterType result = instance->getParameterType(param1);
  288. // Push the return value onto the stack.
  289. lua_pushnumber(state, (int)result);
  290. return 1;
  291. }
  292. lua_pushstring(state, "lua_AIMessage_getParameterType - Failed to match the given parameters to a valid function signature.");
  293. lua_error(state);
  294. break;
  295. }
  296. default:
  297. {
  298. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  299. lua_error(state);
  300. break;
  301. }
  302. }
  303. return 0;
  304. }
  305. int lua_AIMessage_getReceiver(lua_State* state)
  306. {
  307. // Get the number of parameters.
  308. int paramCount = lua_gettop(state);
  309. // Attempt to match the parameters to a valid binding.
  310. switch (paramCount)
  311. {
  312. case 1:
  313. {
  314. if ((lua_type(state, 1) == LUA_TUSERDATA))
  315. {
  316. AIMessage* instance = getInstance(state);
  317. const char* result = instance->getReceiver();
  318. // Push the return value onto the stack.
  319. lua_pushstring(state, result);
  320. return 1;
  321. }
  322. lua_pushstring(state, "lua_AIMessage_getReceiver - Failed to match the given parameters to a valid function signature.");
  323. lua_error(state);
  324. break;
  325. }
  326. default:
  327. {
  328. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  329. lua_error(state);
  330. break;
  331. }
  332. }
  333. return 0;
  334. }
  335. int lua_AIMessage_getSender(lua_State* state)
  336. {
  337. // Get the number of parameters.
  338. int paramCount = lua_gettop(state);
  339. // Attempt to match the parameters to a valid binding.
  340. switch (paramCount)
  341. {
  342. case 1:
  343. {
  344. if ((lua_type(state, 1) == LUA_TUSERDATA))
  345. {
  346. AIMessage* instance = getInstance(state);
  347. const char* result = instance->getSender();
  348. // Push the return value onto the stack.
  349. lua_pushstring(state, result);
  350. return 1;
  351. }
  352. lua_pushstring(state, "lua_AIMessage_getSender - Failed to match the given parameters to a valid function signature.");
  353. lua_error(state);
  354. break;
  355. }
  356. default:
  357. {
  358. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  359. lua_error(state);
  360. break;
  361. }
  362. }
  363. return 0;
  364. }
  365. int lua_AIMessage_getString(lua_State* state)
  366. {
  367. // Get the number of parameters.
  368. int paramCount = lua_gettop(state);
  369. // Attempt to match the parameters to a valid binding.
  370. switch (paramCount)
  371. {
  372. case 2:
  373. {
  374. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  375. lua_type(state, 2) == LUA_TNUMBER)
  376. {
  377. // Get parameter 1 off the stack.
  378. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  379. AIMessage* instance = getInstance(state);
  380. const char* result = instance->getString(param1);
  381. // Push the return value onto the stack.
  382. lua_pushstring(state, result);
  383. return 1;
  384. }
  385. lua_pushstring(state, "lua_AIMessage_getString - Failed to match the given parameters to a valid function signature.");
  386. lua_error(state);
  387. break;
  388. }
  389. default:
  390. {
  391. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  392. lua_error(state);
  393. break;
  394. }
  395. }
  396. return 0;
  397. }
  398. int lua_AIMessage_setBoolean(lua_State* state)
  399. {
  400. // Get the number of parameters.
  401. int paramCount = lua_gettop(state);
  402. // Attempt to match the parameters to a valid binding.
  403. switch (paramCount)
  404. {
  405. case 3:
  406. {
  407. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  408. lua_type(state, 2) == LUA_TNUMBER &&
  409. lua_type(state, 3) == LUA_TBOOLEAN)
  410. {
  411. // Get parameter 1 off the stack.
  412. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  413. // Get parameter 2 off the stack.
  414. bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
  415. AIMessage* instance = getInstance(state);
  416. instance->setBoolean(param1, param2);
  417. return 0;
  418. }
  419. lua_pushstring(state, "lua_AIMessage_setBoolean - Failed to match the given parameters to a valid function signature.");
  420. lua_error(state);
  421. break;
  422. }
  423. default:
  424. {
  425. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  426. lua_error(state);
  427. break;
  428. }
  429. }
  430. return 0;
  431. }
  432. int lua_AIMessage_setDouble(lua_State* state)
  433. {
  434. // Get the number of parameters.
  435. int paramCount = lua_gettop(state);
  436. // Attempt to match the parameters to a valid binding.
  437. switch (paramCount)
  438. {
  439. case 3:
  440. {
  441. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  442. lua_type(state, 2) == LUA_TNUMBER &&
  443. lua_type(state, 3) == LUA_TNUMBER)
  444. {
  445. // Get parameter 1 off the stack.
  446. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  447. // Get parameter 2 off the stack.
  448. double param2 = (double)luaL_checknumber(state, 3);
  449. AIMessage* instance = getInstance(state);
  450. instance->setDouble(param1, param2);
  451. return 0;
  452. }
  453. lua_pushstring(state, "lua_AIMessage_setDouble - Failed to match the given parameters to a valid function signature.");
  454. lua_error(state);
  455. break;
  456. }
  457. default:
  458. {
  459. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  460. lua_error(state);
  461. break;
  462. }
  463. }
  464. return 0;
  465. }
  466. int lua_AIMessage_setFloat(lua_State* state)
  467. {
  468. // Get the number of parameters.
  469. int paramCount = lua_gettop(state);
  470. // Attempt to match the parameters to a valid binding.
  471. switch (paramCount)
  472. {
  473. case 3:
  474. {
  475. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  476. lua_type(state, 2) == LUA_TNUMBER &&
  477. lua_type(state, 3) == LUA_TNUMBER)
  478. {
  479. // Get parameter 1 off the stack.
  480. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  481. // Get parameter 2 off the stack.
  482. float param2 = (float)luaL_checknumber(state, 3);
  483. AIMessage* instance = getInstance(state);
  484. instance->setFloat(param1, param2);
  485. return 0;
  486. }
  487. lua_pushstring(state, "lua_AIMessage_setFloat - Failed to match the given parameters to a valid function signature.");
  488. lua_error(state);
  489. break;
  490. }
  491. default:
  492. {
  493. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  494. lua_error(state);
  495. break;
  496. }
  497. }
  498. return 0;
  499. }
  500. int lua_AIMessage_setInt(lua_State* state)
  501. {
  502. // Get the number of parameters.
  503. int paramCount = lua_gettop(state);
  504. // Attempt to match the parameters to a valid binding.
  505. switch (paramCount)
  506. {
  507. case 3:
  508. {
  509. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  510. lua_type(state, 2) == LUA_TNUMBER &&
  511. lua_type(state, 3) == LUA_TNUMBER)
  512. {
  513. // Get parameter 1 off the stack.
  514. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  515. // Get parameter 2 off the stack.
  516. int param2 = (int)luaL_checkint(state, 3);
  517. AIMessage* instance = getInstance(state);
  518. instance->setInt(param1, param2);
  519. return 0;
  520. }
  521. lua_pushstring(state, "lua_AIMessage_setInt - Failed to match the given parameters to a valid function signature.");
  522. lua_error(state);
  523. break;
  524. }
  525. default:
  526. {
  527. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  528. lua_error(state);
  529. break;
  530. }
  531. }
  532. return 0;
  533. }
  534. int lua_AIMessage_setLong(lua_State* state)
  535. {
  536. // Get the number of parameters.
  537. int paramCount = lua_gettop(state);
  538. // Attempt to match the parameters to a valid binding.
  539. switch (paramCount)
  540. {
  541. case 3:
  542. {
  543. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  544. lua_type(state, 2) == LUA_TNUMBER &&
  545. lua_type(state, 3) == LUA_TNUMBER)
  546. {
  547. // Get parameter 1 off the stack.
  548. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  549. // Get parameter 2 off the stack.
  550. long param2 = (long)luaL_checklong(state, 3);
  551. AIMessage* instance = getInstance(state);
  552. instance->setLong(param1, param2);
  553. return 0;
  554. }
  555. lua_pushstring(state, "lua_AIMessage_setLong - Failed to match the given parameters to a valid function signature.");
  556. lua_error(state);
  557. break;
  558. }
  559. default:
  560. {
  561. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  562. lua_error(state);
  563. break;
  564. }
  565. }
  566. return 0;
  567. }
  568. int lua_AIMessage_setString(lua_State* state)
  569. {
  570. // Get the number of parameters.
  571. int paramCount = lua_gettop(state);
  572. // Attempt to match the parameters to a valid binding.
  573. switch (paramCount)
  574. {
  575. case 3:
  576. {
  577. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  578. lua_type(state, 2) == LUA_TNUMBER &&
  579. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  580. {
  581. // Get parameter 1 off the stack.
  582. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  583. // Get parameter 2 off the stack.
  584. const char* param2 = gameplay::ScriptUtil::getString(3, false);
  585. AIMessage* instance = getInstance(state);
  586. instance->setString(param1, param2);
  587. return 0;
  588. }
  589. lua_pushstring(state, "lua_AIMessage_setString - Failed to match the given parameters to a valid function signature.");
  590. lua_error(state);
  591. break;
  592. }
  593. default:
  594. {
  595. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  596. lua_error(state);
  597. break;
  598. }
  599. }
  600. return 0;
  601. }
  602. int lua_AIMessage_static_create(lua_State* state)
  603. {
  604. // Get the number of parameters.
  605. int paramCount = lua_gettop(state);
  606. // Attempt to match the parameters to a valid binding.
  607. switch (paramCount)
  608. {
  609. case 4:
  610. {
  611. if (lua_type(state, 1) == LUA_TNUMBER &&
  612. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  613. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL) &&
  614. lua_type(state, 4) == LUA_TNUMBER)
  615. {
  616. // Get parameter 1 off the stack.
  617. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
  618. // Get parameter 2 off the stack.
  619. const char* param2 = gameplay::ScriptUtil::getString(2, false);
  620. // Get parameter 3 off the stack.
  621. const char* param3 = gameplay::ScriptUtil::getString(3, false);
  622. // Get parameter 4 off the stack.
  623. unsigned int param4 = (unsigned int)luaL_checkunsigned(state, 4);
  624. void* returnPtr = ((void*)AIMessage::create(param1, param2, param3, param4));
  625. if (returnPtr)
  626. {
  627. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  628. object->instance = returnPtr;
  629. object->owns = false;
  630. luaL_getmetatable(state, "AIMessage");
  631. lua_setmetatable(state, -2);
  632. }
  633. else
  634. {
  635. lua_pushnil(state);
  636. }
  637. return 1;
  638. }
  639. lua_pushstring(state, "lua_AIMessage_static_create - Failed to match the given parameters to a valid function signature.");
  640. lua_error(state);
  641. break;
  642. }
  643. default:
  644. {
  645. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  646. lua_error(state);
  647. break;
  648. }
  649. }
  650. return 0;
  651. }
  652. int lua_AIMessage_static_destroy(lua_State* state)
  653. {
  654. // Get the number of parameters.
  655. int paramCount = lua_gettop(state);
  656. // Attempt to match the parameters to a valid binding.
  657. switch (paramCount)
  658. {
  659. case 1:
  660. {
  661. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
  662. {
  663. // Get parameter 1 off the stack.
  664. bool param1Valid;
  665. gameplay::ScriptUtil::LuaArray<AIMessage> param1 = gameplay::ScriptUtil::getObjectPointer<AIMessage>(1, "AIMessage", false, &param1Valid);
  666. if (!param1Valid)
  667. {
  668. lua_pushstring(state, "Failed to convert parameter 1 to type 'AIMessage'.");
  669. lua_error(state);
  670. }
  671. AIMessage::destroy(param1);
  672. return 0;
  673. }
  674. lua_pushstring(state, "lua_AIMessage_static_destroy - Failed to match the given parameters to a valid function signature.");
  675. lua_error(state);
  676. break;
  677. }
  678. default:
  679. {
  680. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  681. lua_error(state);
  682. break;
  683. }
  684. }
  685. return 0;
  686. }
  687. }