lua_Properties.cpp 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_Properties.h"
  4. #include "Base.h"
  5. #include "FileSystem.h"
  6. #include "Properties.h"
  7. #include "Quaternion.h"
  8. #include "lua_PropertiesType.h"
  9. namespace gameplay
  10. {
  11. void luaRegister_Properties()
  12. {
  13. const luaL_Reg lua_members[] =
  14. {
  15. {"exists", lua_Properties_exists},
  16. {"getBool", lua_Properties_getBool},
  17. {"getColor", lua_Properties_getColor},
  18. {"getFloat", lua_Properties_getFloat},
  19. {"getId", lua_Properties_getId},
  20. {"getInt", lua_Properties_getInt},
  21. {"getLong", lua_Properties_getLong},
  22. {"getMatrix", lua_Properties_getMatrix},
  23. {"getNamespace", lua_Properties_getNamespace},
  24. {"getNextNamespace", lua_Properties_getNextNamespace},
  25. {"getQuaternionFromAxisAngle", lua_Properties_getQuaternionFromAxisAngle},
  26. {"getString", lua_Properties_getString},
  27. {"getType", lua_Properties_getType},
  28. {"getVector2", lua_Properties_getVector2},
  29. {"getVector3", lua_Properties_getVector3},
  30. {"getVector4", lua_Properties_getVector4},
  31. {"rewind", lua_Properties_rewind},
  32. {NULL, NULL}
  33. };
  34. const luaL_Reg lua_statics[] =
  35. {
  36. {"create", lua_Properties_static_create},
  37. {NULL, NULL}
  38. };
  39. std::vector<std::string> scopePath;
  40. gameplay::ScriptUtil::registerClass("Properties", lua_members, NULL, lua_Properties__gc, lua_statics, scopePath);
  41. }
  42. static Properties* getInstance(lua_State* state)
  43. {
  44. void* userdata = luaL_checkudata(state, 1, "Properties");
  45. luaL_argcheck(state, userdata != NULL, 1, "'Properties' expected.");
  46. return (Properties*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  47. }
  48. int lua_Properties__gc(lua_State* state)
  49. {
  50. // Get the number of parameters.
  51. int paramCount = lua_gettop(state);
  52. // Attempt to match the parameters to a valid binding.
  53. switch (paramCount)
  54. {
  55. case 1:
  56. {
  57. if ((lua_type(state, 1) == LUA_TUSERDATA))
  58. {
  59. void* userdata = luaL_checkudata(state, 1, "Properties");
  60. luaL_argcheck(state, userdata != NULL, 1, "'Properties' expected.");
  61. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  62. if (object->owns)
  63. {
  64. Properties* instance = (Properties*)object->instance;
  65. SAFE_DELETE(instance);
  66. }
  67. return 0;
  68. }
  69. lua_pushstring(state, "lua_Properties__gc - Failed to match the given parameters to a valid function signature.");
  70. lua_error(state);
  71. break;
  72. }
  73. default:
  74. {
  75. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  76. lua_error(state);
  77. break;
  78. }
  79. }
  80. return 0;
  81. }
  82. int lua_Properties_exists(lua_State* state)
  83. {
  84. // Get the number of parameters.
  85. int paramCount = lua_gettop(state);
  86. // Attempt to match the parameters to a valid binding.
  87. switch (paramCount)
  88. {
  89. case 2:
  90. {
  91. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  92. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  93. {
  94. // Get parameter 1 off the stack.
  95. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  96. Properties* instance = getInstance(state);
  97. bool result = instance->exists(param1);
  98. // Push the return value onto the stack.
  99. lua_pushboolean(state, result);
  100. return 1;
  101. }
  102. lua_pushstring(state, "lua_Properties_exists - Failed to match the given parameters to a valid function signature.");
  103. lua_error(state);
  104. break;
  105. }
  106. default:
  107. {
  108. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  109. lua_error(state);
  110. break;
  111. }
  112. }
  113. return 0;
  114. }
  115. int lua_Properties_getBool(lua_State* state)
  116. {
  117. // Get the number of parameters.
  118. int paramCount = lua_gettop(state);
  119. // Attempt to match the parameters to a valid binding.
  120. switch (paramCount)
  121. {
  122. case 1:
  123. {
  124. if ((lua_type(state, 1) == LUA_TUSERDATA))
  125. {
  126. Properties* instance = getInstance(state);
  127. bool result = instance->getBool();
  128. // Push the return value onto the stack.
  129. lua_pushboolean(state, result);
  130. return 1;
  131. }
  132. lua_pushstring(state, "lua_Properties_getBool - Failed to match the given parameters to a valid function signature.");
  133. lua_error(state);
  134. break;
  135. }
  136. case 2:
  137. {
  138. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  139. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  140. {
  141. // Get parameter 1 off the stack.
  142. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  143. Properties* instance = getInstance(state);
  144. bool result = instance->getBool(param1);
  145. // Push the return value onto the stack.
  146. lua_pushboolean(state, result);
  147. return 1;
  148. }
  149. lua_pushstring(state, "lua_Properties_getBool - Failed to match the given parameters to a valid function signature.");
  150. lua_error(state);
  151. break;
  152. }
  153. case 3:
  154. {
  155. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  156. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  157. lua_type(state, 3) == LUA_TBOOLEAN)
  158. {
  159. // Get parameter 1 off the stack.
  160. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  161. // Get parameter 2 off the stack.
  162. bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
  163. Properties* instance = getInstance(state);
  164. bool result = instance->getBool(param1, param2);
  165. // Push the return value onto the stack.
  166. lua_pushboolean(state, result);
  167. return 1;
  168. }
  169. lua_pushstring(state, "lua_Properties_getBool - Failed to match the given parameters to a valid function signature.");
  170. lua_error(state);
  171. break;
  172. }
  173. default:
  174. {
  175. lua_pushstring(state, "Invalid number of parameters (expected 1, 2 or 3).");
  176. lua_error(state);
  177. break;
  178. }
  179. }
  180. return 0;
  181. }
  182. int lua_Properties_getColor(lua_State* state)
  183. {
  184. // Get the number of parameters.
  185. int paramCount = lua_gettop(state);
  186. // Attempt to match the parameters to a valid binding.
  187. switch (paramCount)
  188. {
  189. case 3:
  190. {
  191. do
  192. {
  193. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  194. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  195. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  196. {
  197. // Get parameter 1 off the stack.
  198. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  199. // Get parameter 2 off the stack.
  200. bool param2Valid;
  201. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid);
  202. if (!param2Valid)
  203. break;
  204. Properties* instance = getInstance(state);
  205. bool result = instance->getColor(param1, param2);
  206. // Push the return value onto the stack.
  207. lua_pushboolean(state, result);
  208. return 1;
  209. }
  210. } while (0);
  211. do
  212. {
  213. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  214. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  215. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  216. {
  217. // Get parameter 1 off the stack.
  218. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  219. // Get parameter 2 off the stack.
  220. bool param2Valid;
  221. gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid);
  222. if (!param2Valid)
  223. break;
  224. Properties* instance = getInstance(state);
  225. bool result = instance->getColor(param1, param2);
  226. // Push the return value onto the stack.
  227. lua_pushboolean(state, result);
  228. return 1;
  229. }
  230. } while (0);
  231. lua_pushstring(state, "lua_Properties_getColor - Failed to match the given parameters to a valid function signature.");
  232. lua_error(state);
  233. break;
  234. }
  235. default:
  236. {
  237. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  238. lua_error(state);
  239. break;
  240. }
  241. }
  242. return 0;
  243. }
  244. int lua_Properties_getFloat(lua_State* state)
  245. {
  246. // Get the number of parameters.
  247. int paramCount = lua_gettop(state);
  248. // Attempt to match the parameters to a valid binding.
  249. switch (paramCount)
  250. {
  251. case 1:
  252. {
  253. if ((lua_type(state, 1) == LUA_TUSERDATA))
  254. {
  255. Properties* instance = getInstance(state);
  256. float result = instance->getFloat();
  257. // Push the return value onto the stack.
  258. lua_pushnumber(state, result);
  259. return 1;
  260. }
  261. lua_pushstring(state, "lua_Properties_getFloat - Failed to match the given parameters to a valid function signature.");
  262. lua_error(state);
  263. break;
  264. }
  265. case 2:
  266. {
  267. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  268. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  269. {
  270. // Get parameter 1 off the stack.
  271. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  272. Properties* instance = getInstance(state);
  273. float result = instance->getFloat(param1);
  274. // Push the return value onto the stack.
  275. lua_pushnumber(state, result);
  276. return 1;
  277. }
  278. lua_pushstring(state, "lua_Properties_getFloat - Failed to match the given parameters to a valid function signature.");
  279. lua_error(state);
  280. break;
  281. }
  282. default:
  283. {
  284. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  285. lua_error(state);
  286. break;
  287. }
  288. }
  289. return 0;
  290. }
  291. int lua_Properties_getId(lua_State* state)
  292. {
  293. // Get the number of parameters.
  294. int paramCount = lua_gettop(state);
  295. // Attempt to match the parameters to a valid binding.
  296. switch (paramCount)
  297. {
  298. case 1:
  299. {
  300. if ((lua_type(state, 1) == LUA_TUSERDATA))
  301. {
  302. Properties* instance = getInstance(state);
  303. const char* result = instance->getId();
  304. // Push the return value onto the stack.
  305. lua_pushstring(state, result);
  306. return 1;
  307. }
  308. lua_pushstring(state, "lua_Properties_getId - Failed to match the given parameters to a valid function signature.");
  309. lua_error(state);
  310. break;
  311. }
  312. default:
  313. {
  314. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  315. lua_error(state);
  316. break;
  317. }
  318. }
  319. return 0;
  320. }
  321. int lua_Properties_getInt(lua_State* state)
  322. {
  323. // Get the number of parameters.
  324. int paramCount = lua_gettop(state);
  325. // Attempt to match the parameters to a valid binding.
  326. switch (paramCount)
  327. {
  328. case 1:
  329. {
  330. if ((lua_type(state, 1) == LUA_TUSERDATA))
  331. {
  332. Properties* instance = getInstance(state);
  333. int result = instance->getInt();
  334. // Push the return value onto the stack.
  335. lua_pushinteger(state, result);
  336. return 1;
  337. }
  338. lua_pushstring(state, "lua_Properties_getInt - Failed to match the given parameters to a valid function signature.");
  339. lua_error(state);
  340. break;
  341. }
  342. case 2:
  343. {
  344. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  345. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  346. {
  347. // Get parameter 1 off the stack.
  348. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  349. Properties* instance = getInstance(state);
  350. int result = instance->getInt(param1);
  351. // Push the return value onto the stack.
  352. lua_pushinteger(state, result);
  353. return 1;
  354. }
  355. lua_pushstring(state, "lua_Properties_getInt - Failed to match the given parameters to a valid function signature.");
  356. lua_error(state);
  357. break;
  358. }
  359. default:
  360. {
  361. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  362. lua_error(state);
  363. break;
  364. }
  365. }
  366. return 0;
  367. }
  368. int lua_Properties_getLong(lua_State* state)
  369. {
  370. // Get the number of parameters.
  371. int paramCount = lua_gettop(state);
  372. // Attempt to match the parameters to a valid binding.
  373. switch (paramCount)
  374. {
  375. case 1:
  376. {
  377. if ((lua_type(state, 1) == LUA_TUSERDATA))
  378. {
  379. Properties* instance = getInstance(state);
  380. long result = instance->getLong();
  381. // Push the return value onto the stack.
  382. lua_pushinteger(state, result);
  383. return 1;
  384. }
  385. lua_pushstring(state, "lua_Properties_getLong - Failed to match the given parameters to a valid function signature.");
  386. lua_error(state);
  387. break;
  388. }
  389. case 2:
  390. {
  391. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  392. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  393. {
  394. // Get parameter 1 off the stack.
  395. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  396. Properties* instance = getInstance(state);
  397. long result = instance->getLong(param1);
  398. // Push the return value onto the stack.
  399. lua_pushinteger(state, result);
  400. return 1;
  401. }
  402. lua_pushstring(state, "lua_Properties_getLong - Failed to match the given parameters to a valid function signature.");
  403. lua_error(state);
  404. break;
  405. }
  406. default:
  407. {
  408. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  409. lua_error(state);
  410. break;
  411. }
  412. }
  413. return 0;
  414. }
  415. int lua_Properties_getMatrix(lua_State* state)
  416. {
  417. // Get the number of parameters.
  418. int paramCount = lua_gettop(state);
  419. // Attempt to match the parameters to a valid binding.
  420. switch (paramCount)
  421. {
  422. case 3:
  423. {
  424. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  425. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  426. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  427. {
  428. // Get parameter 1 off the stack.
  429. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  430. // Get parameter 2 off the stack.
  431. bool param2Valid;
  432. gameplay::ScriptUtil::LuaArray<Matrix> param2 = gameplay::ScriptUtil::getObjectPointer<Matrix>(3, "Matrix", false, &param2Valid);
  433. if (!param2Valid)
  434. {
  435. lua_pushstring(state, "Failed to convert parameter 2 to type 'Matrix'.");
  436. lua_error(state);
  437. }
  438. Properties* instance = getInstance(state);
  439. bool result = instance->getMatrix(param1, param2);
  440. // Push the return value onto the stack.
  441. lua_pushboolean(state, result);
  442. return 1;
  443. }
  444. lua_pushstring(state, "lua_Properties_getMatrix - Failed to match the given parameters to a valid function signature.");
  445. lua_error(state);
  446. break;
  447. }
  448. default:
  449. {
  450. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  451. lua_error(state);
  452. break;
  453. }
  454. }
  455. return 0;
  456. }
  457. int lua_Properties_getNamespace(lua_State* state)
  458. {
  459. // Get the number of parameters.
  460. int paramCount = lua_gettop(state);
  461. // Attempt to match the parameters to a valid binding.
  462. switch (paramCount)
  463. {
  464. case 1:
  465. {
  466. do
  467. {
  468. if ((lua_type(state, 1) == LUA_TUSERDATA))
  469. {
  470. Properties* instance = getInstance(state);
  471. const char* result = instance->getNamespace();
  472. // Push the return value onto the stack.
  473. lua_pushstring(state, result);
  474. return 1;
  475. }
  476. } while (0);
  477. lua_pushstring(state, "lua_Properties_getNamespace - Failed to match the given parameters to a valid function signature.");
  478. lua_error(state);
  479. break;
  480. }
  481. case 2:
  482. {
  483. do
  484. {
  485. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  486. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  487. {
  488. // Get parameter 1 off the stack.
  489. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  490. Properties* instance = getInstance(state);
  491. void* returnPtr = (void*)instance->getNamespace(param1);
  492. if (returnPtr)
  493. {
  494. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  495. object->instance = returnPtr;
  496. object->owns = false;
  497. luaL_getmetatable(state, "Properties");
  498. lua_setmetatable(state, -2);
  499. }
  500. else
  501. {
  502. lua_pushnil(state);
  503. }
  504. return 1;
  505. }
  506. } while (0);
  507. lua_pushstring(state, "lua_Properties_getNamespace - Failed to match the given parameters to a valid function signature.");
  508. lua_error(state);
  509. break;
  510. }
  511. case 3:
  512. {
  513. do
  514. {
  515. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  516. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  517. lua_type(state, 3) == LUA_TBOOLEAN)
  518. {
  519. // Get parameter 1 off the stack.
  520. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  521. // Get parameter 2 off the stack.
  522. bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
  523. Properties* instance = getInstance(state);
  524. void* returnPtr = (void*)instance->getNamespace(param1, param2);
  525. if (returnPtr)
  526. {
  527. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  528. object->instance = returnPtr;
  529. object->owns = false;
  530. luaL_getmetatable(state, "Properties");
  531. lua_setmetatable(state, -2);
  532. }
  533. else
  534. {
  535. lua_pushnil(state);
  536. }
  537. return 1;
  538. }
  539. } while (0);
  540. lua_pushstring(state, "lua_Properties_getNamespace - Failed to match the given parameters to a valid function signature.");
  541. lua_error(state);
  542. break;
  543. }
  544. case 4:
  545. {
  546. do
  547. {
  548. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  549. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  550. lua_type(state, 3) == LUA_TBOOLEAN &&
  551. lua_type(state, 4) == LUA_TBOOLEAN)
  552. {
  553. // Get parameter 1 off the stack.
  554. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  555. // Get parameter 2 off the stack.
  556. bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
  557. // Get parameter 3 off the stack.
  558. bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
  559. Properties* instance = getInstance(state);
  560. void* returnPtr = (void*)instance->getNamespace(param1, param2, param3);
  561. if (returnPtr)
  562. {
  563. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  564. object->instance = returnPtr;
  565. object->owns = false;
  566. luaL_getmetatable(state, "Properties");
  567. lua_setmetatable(state, -2);
  568. }
  569. else
  570. {
  571. lua_pushnil(state);
  572. }
  573. return 1;
  574. }
  575. } while (0);
  576. lua_pushstring(state, "lua_Properties_getNamespace - Failed to match the given parameters to a valid function signature.");
  577. lua_error(state);
  578. break;
  579. }
  580. default:
  581. {
  582. lua_pushstring(state, "Invalid number of parameters (expected 1, 2, 3 or 4).");
  583. lua_error(state);
  584. break;
  585. }
  586. }
  587. return 0;
  588. }
  589. int lua_Properties_getNextNamespace(lua_State* state)
  590. {
  591. // Get the number of parameters.
  592. int paramCount = lua_gettop(state);
  593. // Attempt to match the parameters to a valid binding.
  594. switch (paramCount)
  595. {
  596. case 1:
  597. {
  598. if ((lua_type(state, 1) == LUA_TUSERDATA))
  599. {
  600. Properties* instance = getInstance(state);
  601. void* returnPtr = (void*)instance->getNextNamespace();
  602. if (returnPtr)
  603. {
  604. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  605. object->instance = returnPtr;
  606. object->owns = false;
  607. luaL_getmetatable(state, "Properties");
  608. lua_setmetatable(state, -2);
  609. }
  610. else
  611. {
  612. lua_pushnil(state);
  613. }
  614. return 1;
  615. }
  616. lua_pushstring(state, "lua_Properties_getNextNamespace - Failed to match the given parameters to a valid function signature.");
  617. lua_error(state);
  618. break;
  619. }
  620. default:
  621. {
  622. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  623. lua_error(state);
  624. break;
  625. }
  626. }
  627. return 0;
  628. }
  629. int lua_Properties_getQuaternionFromAxisAngle(lua_State* state)
  630. {
  631. // Get the number of parameters.
  632. int paramCount = lua_gettop(state);
  633. // Attempt to match the parameters to a valid binding.
  634. switch (paramCount)
  635. {
  636. case 3:
  637. {
  638. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  639. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  640. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  641. {
  642. // Get parameter 1 off the stack.
  643. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  644. // Get parameter 2 off the stack.
  645. bool param2Valid;
  646. gameplay::ScriptUtil::LuaArray<Quaternion> param2 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(3, "Quaternion", false, &param2Valid);
  647. if (!param2Valid)
  648. {
  649. lua_pushstring(state, "Failed to convert parameter 2 to type 'Quaternion'.");
  650. lua_error(state);
  651. }
  652. Properties* instance = getInstance(state);
  653. bool result = instance->getQuaternionFromAxisAngle(param1, param2);
  654. // Push the return value onto the stack.
  655. lua_pushboolean(state, result);
  656. return 1;
  657. }
  658. lua_pushstring(state, "lua_Properties_getQuaternionFromAxisAngle - Failed to match the given parameters to a valid function signature.");
  659. lua_error(state);
  660. break;
  661. }
  662. default:
  663. {
  664. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  665. lua_error(state);
  666. break;
  667. }
  668. }
  669. return 0;
  670. }
  671. int lua_Properties_getString(lua_State* state)
  672. {
  673. // Get the number of parameters.
  674. int paramCount = lua_gettop(state);
  675. // Attempt to match the parameters to a valid binding.
  676. switch (paramCount)
  677. {
  678. case 1:
  679. {
  680. if ((lua_type(state, 1) == LUA_TUSERDATA))
  681. {
  682. Properties* instance = getInstance(state);
  683. const char* result = instance->getString();
  684. // Push the return value onto the stack.
  685. lua_pushstring(state, result);
  686. return 1;
  687. }
  688. lua_pushstring(state, "lua_Properties_getString - Failed to match the given parameters to a valid function signature.");
  689. lua_error(state);
  690. break;
  691. }
  692. case 2:
  693. {
  694. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  695. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  696. {
  697. // Get parameter 1 off the stack.
  698. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  699. Properties* instance = getInstance(state);
  700. const char* result = instance->getString(param1);
  701. // Push the return value onto the stack.
  702. lua_pushstring(state, result);
  703. return 1;
  704. }
  705. lua_pushstring(state, "lua_Properties_getString - Failed to match the given parameters to a valid function signature.");
  706. lua_error(state);
  707. break;
  708. }
  709. case 3:
  710. {
  711. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  712. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  713. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  714. {
  715. // Get parameter 1 off the stack.
  716. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  717. // Get parameter 2 off the stack.
  718. const char* param2 = gameplay::ScriptUtil::getString(3, false);
  719. Properties* instance = getInstance(state);
  720. const char* result = instance->getString(param1, param2);
  721. // Push the return value onto the stack.
  722. lua_pushstring(state, result);
  723. return 1;
  724. }
  725. lua_pushstring(state, "lua_Properties_getString - Failed to match the given parameters to a valid function signature.");
  726. lua_error(state);
  727. break;
  728. }
  729. default:
  730. {
  731. lua_pushstring(state, "Invalid number of parameters (expected 1, 2 or 3).");
  732. lua_error(state);
  733. break;
  734. }
  735. }
  736. return 0;
  737. }
  738. int lua_Properties_getType(lua_State* state)
  739. {
  740. // Get the number of parameters.
  741. int paramCount = lua_gettop(state);
  742. // Attempt to match the parameters to a valid binding.
  743. switch (paramCount)
  744. {
  745. case 1:
  746. {
  747. if ((lua_type(state, 1) == LUA_TUSERDATA))
  748. {
  749. Properties* instance = getInstance(state);
  750. Properties::Type result = instance->getType();
  751. // Push the return value onto the stack.
  752. lua_pushstring(state, lua_stringFromEnum_PropertiesType(result));
  753. return 1;
  754. }
  755. lua_pushstring(state, "lua_Properties_getType - Failed to match the given parameters to a valid function signature.");
  756. lua_error(state);
  757. break;
  758. }
  759. case 2:
  760. {
  761. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  762. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  763. {
  764. // Get parameter 1 off the stack.
  765. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  766. Properties* instance = getInstance(state);
  767. Properties::Type result = instance->getType(param1);
  768. // Push the return value onto the stack.
  769. lua_pushstring(state, lua_stringFromEnum_PropertiesType(result));
  770. return 1;
  771. }
  772. lua_pushstring(state, "lua_Properties_getType - Failed to match the given parameters to a valid function signature.");
  773. lua_error(state);
  774. break;
  775. }
  776. default:
  777. {
  778. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  779. lua_error(state);
  780. break;
  781. }
  782. }
  783. return 0;
  784. }
  785. int lua_Properties_getVector2(lua_State* state)
  786. {
  787. // Get the number of parameters.
  788. int paramCount = lua_gettop(state);
  789. // Attempt to match the parameters to a valid binding.
  790. switch (paramCount)
  791. {
  792. case 3:
  793. {
  794. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  795. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  796. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  797. {
  798. // Get parameter 1 off the stack.
  799. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  800. // Get parameter 2 off the stack.
  801. bool param2Valid;
  802. gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid);
  803. if (!param2Valid)
  804. {
  805. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector2'.");
  806. lua_error(state);
  807. }
  808. Properties* instance = getInstance(state);
  809. bool result = instance->getVector2(param1, param2);
  810. // Push the return value onto the stack.
  811. lua_pushboolean(state, result);
  812. return 1;
  813. }
  814. lua_pushstring(state, "lua_Properties_getVector2 - Failed to match the given parameters to a valid function signature.");
  815. lua_error(state);
  816. break;
  817. }
  818. default:
  819. {
  820. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  821. lua_error(state);
  822. break;
  823. }
  824. }
  825. return 0;
  826. }
  827. int lua_Properties_getVector3(lua_State* state)
  828. {
  829. // Get the number of parameters.
  830. int paramCount = lua_gettop(state);
  831. // Attempt to match the parameters to a valid binding.
  832. switch (paramCount)
  833. {
  834. case 3:
  835. {
  836. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  837. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  838. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  839. {
  840. // Get parameter 1 off the stack.
  841. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  842. // Get parameter 2 off the stack.
  843. bool param2Valid;
  844. gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid);
  845. if (!param2Valid)
  846. {
  847. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  848. lua_error(state);
  849. }
  850. Properties* instance = getInstance(state);
  851. bool result = instance->getVector3(param1, param2);
  852. // Push the return value onto the stack.
  853. lua_pushboolean(state, result);
  854. return 1;
  855. }
  856. lua_pushstring(state, "lua_Properties_getVector3 - Failed to match the given parameters to a valid function signature.");
  857. lua_error(state);
  858. break;
  859. }
  860. default:
  861. {
  862. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  863. lua_error(state);
  864. break;
  865. }
  866. }
  867. return 0;
  868. }
  869. int lua_Properties_getVector4(lua_State* state)
  870. {
  871. // Get the number of parameters.
  872. int paramCount = lua_gettop(state);
  873. // Attempt to match the parameters to a valid binding.
  874. switch (paramCount)
  875. {
  876. case 3:
  877. {
  878. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  879. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  880. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  881. {
  882. // Get parameter 1 off the stack.
  883. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  884. // Get parameter 2 off the stack.
  885. bool param2Valid;
  886. gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid);
  887. if (!param2Valid)
  888. {
  889. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector4'.");
  890. lua_error(state);
  891. }
  892. Properties* instance = getInstance(state);
  893. bool result = instance->getVector4(param1, param2);
  894. // Push the return value onto the stack.
  895. lua_pushboolean(state, result);
  896. return 1;
  897. }
  898. lua_pushstring(state, "lua_Properties_getVector4 - Failed to match the given parameters to a valid function signature.");
  899. lua_error(state);
  900. break;
  901. }
  902. default:
  903. {
  904. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  905. lua_error(state);
  906. break;
  907. }
  908. }
  909. return 0;
  910. }
  911. int lua_Properties_rewind(lua_State* state)
  912. {
  913. // Get the number of parameters.
  914. int paramCount = lua_gettop(state);
  915. // Attempt to match the parameters to a valid binding.
  916. switch (paramCount)
  917. {
  918. case 1:
  919. {
  920. if ((lua_type(state, 1) == LUA_TUSERDATA))
  921. {
  922. Properties* instance = getInstance(state);
  923. instance->rewind();
  924. return 0;
  925. }
  926. lua_pushstring(state, "lua_Properties_rewind - Failed to match the given parameters to a valid function signature.");
  927. lua_error(state);
  928. break;
  929. }
  930. default:
  931. {
  932. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  933. lua_error(state);
  934. break;
  935. }
  936. }
  937. return 0;
  938. }
  939. int lua_Properties_static_create(lua_State* state)
  940. {
  941. // Get the number of parameters.
  942. int paramCount = lua_gettop(state);
  943. // Attempt to match the parameters to a valid binding.
  944. switch (paramCount)
  945. {
  946. case 1:
  947. {
  948. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  949. {
  950. // Get parameter 1 off the stack.
  951. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  952. void* returnPtr = (void*)Properties::create(param1);
  953. if (returnPtr)
  954. {
  955. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  956. object->instance = returnPtr;
  957. object->owns = true;
  958. luaL_getmetatable(state, "Properties");
  959. lua_setmetatable(state, -2);
  960. }
  961. else
  962. {
  963. lua_pushnil(state);
  964. }
  965. return 1;
  966. }
  967. lua_pushstring(state, "lua_Properties_static_create - Failed to match the given parameters to a valid function signature.");
  968. lua_error(state);
  969. break;
  970. }
  971. default:
  972. {
  973. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  974. lua_error(state);
  975. break;
  976. }
  977. }
  978. return 0;
  979. }
  980. }