lua_Ray.cpp 24 KB

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