lua_Properties.cpp 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  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. 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*)((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. ScriptUtil::LuaObject* object = (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. ScriptUtil::LuaArray<const char> param1 = 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. ScriptUtil::LuaArray<const char> param1 = 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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  161. // Get parameter 2 off the stack.
  162. bool param2 = 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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  199. // Get parameter 2 off the stack.
  200. bool param2Valid;
  201. ScriptUtil::LuaArray<Vector3> param2 = 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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  219. // Get parameter 2 off the stack.
  220. bool param2Valid;
  221. ScriptUtil::LuaArray<Vector4> param2 = 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. ScriptUtil::LuaArray<const char> param1 = 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. ScriptUtil::LuaArray<const char> param1 = 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. ScriptUtil::LuaArray<const char> param1 = 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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  430. // Get parameter 2 off the stack.
  431. bool param2Valid;
  432. ScriptUtil::LuaArray<Matrix> param2 = 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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  490. Properties* instance = getInstance(state);
  491. void* returnPtr = (void*)instance->getNamespace(param1);
  492. if (returnPtr)
  493. {
  494. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(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. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  521. // Get parameter 2 off the stack.
  522. bool param2 = ScriptUtil::luaCheckBool(state, 3);
  523. Properties* instance = getInstance(state);
  524. void* returnPtr = (void*)instance->getNamespace(param1, param2);
  525. if (returnPtr)
  526. {
  527. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(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. default:
  545. {
  546. lua_pushstring(state, "Invalid number of parameters (expected 1, 2 or 3).");
  547. lua_error(state);
  548. break;
  549. }
  550. }
  551. return 0;
  552. }
  553. int lua_Properties_getNextNamespace(lua_State* state)
  554. {
  555. // Get the number of parameters.
  556. int paramCount = lua_gettop(state);
  557. // Attempt to match the parameters to a valid binding.
  558. switch (paramCount)
  559. {
  560. case 1:
  561. {
  562. if ((lua_type(state, 1) == LUA_TUSERDATA))
  563. {
  564. Properties* instance = getInstance(state);
  565. void* returnPtr = (void*)instance->getNextNamespace();
  566. if (returnPtr)
  567. {
  568. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  569. object->instance = returnPtr;
  570. object->owns = false;
  571. luaL_getmetatable(state, "Properties");
  572. lua_setmetatable(state, -2);
  573. }
  574. else
  575. {
  576. lua_pushnil(state);
  577. }
  578. return 1;
  579. }
  580. lua_pushstring(state, "lua_Properties_getNextNamespace - Failed to match the given parameters to a valid function signature.");
  581. lua_error(state);
  582. break;
  583. }
  584. default:
  585. {
  586. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  587. lua_error(state);
  588. break;
  589. }
  590. }
  591. return 0;
  592. }
  593. int lua_Properties_getQuaternionFromAxisAngle(lua_State* state)
  594. {
  595. // Get the number of parameters.
  596. int paramCount = lua_gettop(state);
  597. // Attempt to match the parameters to a valid binding.
  598. switch (paramCount)
  599. {
  600. case 3:
  601. {
  602. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  603. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  604. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  605. {
  606. // Get parameter 1 off the stack.
  607. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  608. // Get parameter 2 off the stack.
  609. bool param2Valid;
  610. ScriptUtil::LuaArray<Quaternion> param2 = ScriptUtil::getObjectPointer<Quaternion>(3, "Quaternion", false, &param2Valid);
  611. if (!param2Valid)
  612. {
  613. lua_pushstring(state, "Failed to convert parameter 2 to type 'Quaternion'.");
  614. lua_error(state);
  615. }
  616. Properties* instance = getInstance(state);
  617. bool result = instance->getQuaternionFromAxisAngle(param1, param2);
  618. // Push the return value onto the stack.
  619. lua_pushboolean(state, result);
  620. return 1;
  621. }
  622. lua_pushstring(state, "lua_Properties_getQuaternionFromAxisAngle - Failed to match the given parameters to a valid function signature.");
  623. lua_error(state);
  624. break;
  625. }
  626. default:
  627. {
  628. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  629. lua_error(state);
  630. break;
  631. }
  632. }
  633. return 0;
  634. }
  635. int lua_Properties_getString(lua_State* state)
  636. {
  637. // Get the number of parameters.
  638. int paramCount = lua_gettop(state);
  639. // Attempt to match the parameters to a valid binding.
  640. switch (paramCount)
  641. {
  642. case 1:
  643. {
  644. if ((lua_type(state, 1) == LUA_TUSERDATA))
  645. {
  646. Properties* instance = getInstance(state);
  647. const char* result = instance->getString();
  648. // Push the return value onto the stack.
  649. lua_pushstring(state, result);
  650. return 1;
  651. }
  652. lua_pushstring(state, "lua_Properties_getString - Failed to match the given parameters to a valid function signature.");
  653. lua_error(state);
  654. break;
  655. }
  656. case 2:
  657. {
  658. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  659. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  660. {
  661. // Get parameter 1 off the stack.
  662. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  663. Properties* instance = getInstance(state);
  664. const char* result = instance->getString(param1);
  665. // Push the return value onto the stack.
  666. lua_pushstring(state, result);
  667. return 1;
  668. }
  669. lua_pushstring(state, "lua_Properties_getString - Failed to match the given parameters to a valid function signature.");
  670. lua_error(state);
  671. break;
  672. }
  673. default:
  674. {
  675. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  676. lua_error(state);
  677. break;
  678. }
  679. }
  680. return 0;
  681. }
  682. int lua_Properties_getType(lua_State* state)
  683. {
  684. // Get the number of parameters.
  685. int paramCount = lua_gettop(state);
  686. // Attempt to match the parameters to a valid binding.
  687. switch (paramCount)
  688. {
  689. case 1:
  690. {
  691. if ((lua_type(state, 1) == LUA_TUSERDATA))
  692. {
  693. Properties* instance = getInstance(state);
  694. Properties::Type result = instance->getType();
  695. // Push the return value onto the stack.
  696. lua_pushstring(state, lua_stringFromEnum_PropertiesType(result));
  697. return 1;
  698. }
  699. lua_pushstring(state, "lua_Properties_getType - Failed to match the given parameters to a valid function signature.");
  700. lua_error(state);
  701. break;
  702. }
  703. case 2:
  704. {
  705. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  706. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  707. {
  708. // Get parameter 1 off the stack.
  709. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  710. Properties* instance = getInstance(state);
  711. Properties::Type result = instance->getType(param1);
  712. // Push the return value onto the stack.
  713. lua_pushstring(state, lua_stringFromEnum_PropertiesType(result));
  714. return 1;
  715. }
  716. lua_pushstring(state, "lua_Properties_getType - Failed to match the given parameters to a valid function signature.");
  717. lua_error(state);
  718. break;
  719. }
  720. default:
  721. {
  722. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  723. lua_error(state);
  724. break;
  725. }
  726. }
  727. return 0;
  728. }
  729. int lua_Properties_getVector2(lua_State* state)
  730. {
  731. // Get the number of parameters.
  732. int paramCount = lua_gettop(state);
  733. // Attempt to match the parameters to a valid binding.
  734. switch (paramCount)
  735. {
  736. case 3:
  737. {
  738. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  739. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  740. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  741. {
  742. // Get parameter 1 off the stack.
  743. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  744. // Get parameter 2 off the stack.
  745. bool param2Valid;
  746. ScriptUtil::LuaArray<Vector2> param2 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid);
  747. if (!param2Valid)
  748. {
  749. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector2'.");
  750. lua_error(state);
  751. }
  752. Properties* instance = getInstance(state);
  753. bool result = instance->getVector2(param1, param2);
  754. // Push the return value onto the stack.
  755. lua_pushboolean(state, result);
  756. return 1;
  757. }
  758. lua_pushstring(state, "lua_Properties_getVector2 - Failed to match the given parameters to a valid function signature.");
  759. lua_error(state);
  760. break;
  761. }
  762. default:
  763. {
  764. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  765. lua_error(state);
  766. break;
  767. }
  768. }
  769. return 0;
  770. }
  771. int lua_Properties_getVector3(lua_State* state)
  772. {
  773. // Get the number of parameters.
  774. int paramCount = lua_gettop(state);
  775. // Attempt to match the parameters to a valid binding.
  776. switch (paramCount)
  777. {
  778. case 3:
  779. {
  780. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  781. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  782. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  783. {
  784. // Get parameter 1 off the stack.
  785. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  786. // Get parameter 2 off the stack.
  787. bool param2Valid;
  788. ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", false, &param2Valid);
  789. if (!param2Valid)
  790. {
  791. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
  792. lua_error(state);
  793. }
  794. Properties* instance = getInstance(state);
  795. bool result = instance->getVector3(param1, param2);
  796. // Push the return value onto the stack.
  797. lua_pushboolean(state, result);
  798. return 1;
  799. }
  800. lua_pushstring(state, "lua_Properties_getVector3 - Failed to match the given parameters to a valid function signature.");
  801. lua_error(state);
  802. break;
  803. }
  804. default:
  805. {
  806. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  807. lua_error(state);
  808. break;
  809. }
  810. }
  811. return 0;
  812. }
  813. int lua_Properties_getVector4(lua_State* state)
  814. {
  815. // Get the number of parameters.
  816. int paramCount = lua_gettop(state);
  817. // Attempt to match the parameters to a valid binding.
  818. switch (paramCount)
  819. {
  820. case 3:
  821. {
  822. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  823. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  824. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  825. {
  826. // Get parameter 1 off the stack.
  827. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  828. // Get parameter 2 off the stack.
  829. bool param2Valid;
  830. ScriptUtil::LuaArray<Vector4> param2 = ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", false, &param2Valid);
  831. if (!param2Valid)
  832. {
  833. lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector4'.");
  834. lua_error(state);
  835. }
  836. Properties* instance = getInstance(state);
  837. bool result = instance->getVector4(param1, param2);
  838. // Push the return value onto the stack.
  839. lua_pushboolean(state, result);
  840. return 1;
  841. }
  842. lua_pushstring(state, "lua_Properties_getVector4 - Failed to match the given parameters to a valid function signature.");
  843. lua_error(state);
  844. break;
  845. }
  846. default:
  847. {
  848. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  849. lua_error(state);
  850. break;
  851. }
  852. }
  853. return 0;
  854. }
  855. int lua_Properties_rewind(lua_State* state)
  856. {
  857. // Get the number of parameters.
  858. int paramCount = lua_gettop(state);
  859. // Attempt to match the parameters to a valid binding.
  860. switch (paramCount)
  861. {
  862. case 1:
  863. {
  864. if ((lua_type(state, 1) == LUA_TUSERDATA))
  865. {
  866. Properties* instance = getInstance(state);
  867. instance->rewind();
  868. return 0;
  869. }
  870. lua_pushstring(state, "lua_Properties_rewind - Failed to match the given parameters to a valid function signature.");
  871. lua_error(state);
  872. break;
  873. }
  874. default:
  875. {
  876. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  877. lua_error(state);
  878. break;
  879. }
  880. }
  881. return 0;
  882. }
  883. int lua_Properties_static_create(lua_State* state)
  884. {
  885. // Get the number of parameters.
  886. int paramCount = lua_gettop(state);
  887. // Attempt to match the parameters to a valid binding.
  888. switch (paramCount)
  889. {
  890. case 1:
  891. {
  892. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  893. {
  894. // Get parameter 1 off the stack.
  895. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
  896. void* returnPtr = (void*)Properties::create(param1);
  897. if (returnPtr)
  898. {
  899. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  900. object->instance = returnPtr;
  901. object->owns = true;
  902. luaL_getmetatable(state, "Properties");
  903. lua_setmetatable(state, -2);
  904. }
  905. else
  906. {
  907. lua_pushnil(state);
  908. }
  909. return 1;
  910. }
  911. lua_pushstring(state, "lua_Properties_static_create - Failed to match the given parameters to a valid function signature.");
  912. lua_error(state);
  913. break;
  914. }
  915. default:
  916. {
  917. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  918. lua_error(state);
  919. break;
  920. }
  921. }
  922. return 0;
  923. }
  924. }