lua_Properties.cpp 35 KB

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