lua_api.txt 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. .. contents::
  2. Math
  3. ====
  4. Vector3
  5. -------
  6. **Vector3** (x, y, z) : Vector3
  7. Returns a new vector from individual components.
  8. **x** (v) : float
  9. Returns the x value of the vector.
  10. **y** (v) : float
  11. Returns the y value of the vector.
  12. **z** (v) : float
  13. Returns the z value of the vector.
  14. **.x** : float
  15. Returns/assigns the x value of the vector.
  16. **.y** : float
  17. Returns/assigns the y value of the vector.
  18. **.z** : float
  19. Returns/assigns the z value of the vector.
  20. **set_x** (v, x)
  21. Sets the value of the x value of the vector.
  22. **set_y** (v, y)
  23. Sets the value of the y value of the vector.
  24. **set_z** (v, z)
  25. Sets the value of the z value of the vector.
  26. **elements** (v) : float, float, float
  27. Returns the x, y and z elements of the vector.
  28. **add** (a, b) : Vector3
  29. Adds the vector *a* to *b* and returns the result.
  30. **subtract** (a, b) : Vector3
  31. Subtracts the vector *b* from *a* and returns the result.
  32. **multiply** (a, k) : Vector3
  33. Multiplies the vector *a* by the scalar *k* and returns the result.
  34. **dot** (a, b) : float
  35. Returns the dot product between the vectors *a* and *b*.
  36. **cross** (a, b) : Vector3
  37. Returns the cross product between the vectors *a* and *b*.
  38. **equal** (a, b) : bool
  39. Returns true whether the vectors *a* and *b* are equal.
  40. **length** (a) : float
  41. Returns the lenght of *a*.
  42. **length_squared** (a) : float
  43. Returns the squared length of *a*.
  44. **set_length** (a, len)
  45. Sets the lenght of *a* to *len*.
  46. **normalize** (a) : Vector3
  47. Normalizes *a* and returns the result.
  48. **distance** (a, b) : float
  49. Returns the distance between the points *a* and *b*.
  50. **distance_squared** (a, b) : float
  51. Returns the squared distance between the points *a* and *b*.
  52. **angle** (a, b) : float
  53. Returns the angle between the vectors *a* and *b*.
  54. **max** (a, b) : Vector3
  55. Returns a vector that contains the largest value for each component from *a* and *b*.
  56. **min** (a, b) : Vector3
  57. Returns a vector that contains the smallest value for each component from *a* and *b*.
  58. **lerp** (a, b, t) : Vector3
  59. Returns the linearly interpolated vector between *a* and *b* at time *t* in [0, 1].
  60. **forward** () : Vector3
  61. **backward** () : Vector3
  62. **left** () : Vector3
  63. **right** () : Vector3
  64. **up** () : Vector3
  65. **down** () : Vector3
  66. Returns the corresponding semantic axis.
  67. **zero** () : Vector3
  68. Returns a vector with all values set to zero.
  69. **to_string** (v) : string
  70. Returns a string representing the vector *v*.
  71. Vector3Box
  72. ----------
  73. **Vector3Box** () : Vector3Box
  74. Returns a new Vector3Box.
  75. **Vector3Box** (v) : Vector3Box
  76. Returns a new Vector3Box from the Vector3 *v*.
  77. **Vector3Box** (x, y, z) : Vector3Box
  78. Returns a new Vector3Box from components.
  79. **store** (v)
  80. Stores the Vector3 *v* in the box.
  81. **store** (x, y, z)
  82. Stores Vector3(x, y, z) in the box.
  83. **unbox** () : Vector3
  84. Returns the stored vector from the box.
  85. Quaternion
  86. ----------
  87. **Quaternion** (axis, angle) : Quaternion
  88. Returns a new quaternion from *axis* and *angle*.
  89. **negate** (q) : Quaternion
  90. Negates the quaternion *q* and returns the result.
  91. **identity** () : Quaternion
  92. Returns the identity quaternion.
  93. **multiply** (a, b) : Quaternion
  94. Multiplies the quaternions *a* and *b*. (i.e. rotates first by *a* then by *b*).
  95. **multiply_by_scalar** (a, k) : Quaternion
  96. Multiplies the quaternion *a* by the scalar *k*.
  97. **dot** (a, b) : float
  98. Returns the dot product between quaternions *a* and *b*.
  99. **length** (q) : float
  100. Returns the length of *q*.
  101. **normalize** (q) : Quaternion
  102. Normalizes the quaternion *q* and returns the result.
  103. **conjugate** (q) : Quaternion
  104. Returns the conjugate of quaternion *q*.
  105. **inverse** (q) : Quaternion
  106. Returns the inverse of quaternion *q*.
  107. **power** (q, exp) : Quaternion
  108. Returns the quaternion *q* raised to the power of *exp*.
  109. **elements** (q) : float, float, float, float
  110. Returns the x, y, z and w elements of the quaternion.
  111. **look** (dir, [up]) : Quaternion
  112. Returns the quaternion describing the rotation needed to face towards *dir*.
  113. If *up* is not specified, Vector3.up() is used.
  114. **right** (q) : Vector3
  115. Returns the right axis of the rotation described by *q*.
  116. **up** (q) : Vector3
  117. Returns the up axis of the rotation described by *q*.
  118. **forward** (q) : Vector3
  119. Returns the forward axis of the rotation described by *q*.
  120. **lerp** (a, b, t) : Quaternion
  121. Returns the linearly interpolated quaternion between *a* and *b* at time *t* in [0, 1].
  122. It uses NLerp.
  123. **to_string** (q) : string
  124. Returns a string representing the quaternion *q*.
  125. QuaternionBox
  126. -------------
  127. **QuaternionBox** () : QuaternionBox
  128. Returns a new QuaternionBox.
  129. **QuaternionBox** (q) : QuaternionBox
  130. Returns a new QuaternionBox from the Quaternion *q*.
  131. **QuaternionBox** (x, y, z, w) : QuaternionBox
  132. Returns a new QuaternionBox from elements.
  133. **store(q)** ()
  134. Stores the Quaternion *q* in the box.
  135. **store** (x, y, z, w)
  136. Stores Quaternion(x, y, z, w) in the box.
  137. **unbox** () : Quaternion
  138. Returns the stored quaternion from the box.
  139. Matrix4x4
  140. ---------
  141. **Matrix4x4** (xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, tx, ty, tz, tw) : Matrix4x4
  142. Returns a new matrix from individual components.
  143. **from_quaternion** (q) : Matrix4x4
  144. Returns a new matrix from *q*.
  145. **from_translation** (t) : Matrix4x4
  146. Returns a new matrix from *t*.
  147. **from_quaternion_translation** (q, t) : Matrix4x4
  148. Returns a new matrix from *q* and *t*.
  149. **from_axes** (x, y, z, t) : Matrix4x4
  150. Returns a new matrix from *x*, *y*, *z* and *t*.
  151. **copy** (m) : Matrix4x4
  152. Returns a copy of the matrix *m*.
  153. **add** (a, b) : Matrix4x4
  154. Adds the matrix *a* to *b* and returns the result.
  155. **subtract** (a, b) : Matrix4x4
  156. Subtracts the matrix *b* from *a* and returns the result.
  157. **multiply** (a, b) : Matrix4x4
  158. Multiplies the matrix *a* by *b* and returns the result. (i.e. transforms first by *a* then by *b*)
  159. **transpose** (m) : Matrix4x4
  160. Transposes the matrix *m* and returns the result.
  161. **determinant** (m) : float
  162. Returns the determinant of the matrix *m*.
  163. **invert** (m) : Matrix4x4
  164. Inverts the matrix *m* and returns the result.
  165. **x** (m) : Vector3
  166. Returns the x axis of the matrix *m*.
  167. **y** (m) : Vector3
  168. Returns the y axis of the matrix *m*.
  169. **z** (m) : Vector3
  170. Returns the z axis of the matrix *m*.
  171. **set_x** (m, x)
  172. Sets the x axis of the matrix *m*.
  173. **set_y** (m, y)
  174. Sets the y axis of the matrix *m*.
  175. **set_z** (m, z)
  176. Sets the z axis of the matrix *m*.
  177. **rotation** (m) : Quaternion
  178. Returns the rotation portion of the matrix *m*.
  179. **set_rotation** (m, r)
  180. Sets the rotation portion of the matrix *m*.
  181. **translation** (m, a) : Vector3
  182. Returns the translation portion of the matrix *m*.
  183. **set_translation** (m, t)
  184. Sets the translation portion of the matrix *m*.
  185. **identity** ()
  186. Returns the identity matrix.
  187. **transform** (m, v) : Vector3
  188. Transforms the vector *v* by the matrix *m* and returns the result.
  189. **to_string** (m) : string
  190. Returns a string representing the matrix *m*.
  191. Matrix4x4Box
  192. ------------
  193. **Matrix4x4Box** (m) : Matrix4x4Box
  194. Returns a new Matrix4x4Box from the Matrix4x4 *m*.
  195. **store** (m)
  196. Stores the Matrix4x4 *m* in the box.
  197. **unbox** () : Matrix4x4
  198. Returns the stored matrix from the box.
  199. Color4
  200. ------
  201. **Color4** (r, g, b, a) : Color4
  202. Returns a new Color4 from individual components.
  203. **to_string** (c) : string
  204. Returns a string representing the color *c*.
  205. Math
  206. ----
  207. **ray_plane_intersection** (from, dir, point, normal) : float
  208. Returns the distance along ray (from, dir) to intersection point with plane defined by
  209. *point* and *normal* or -1.0 if no intersection.
  210. **ray_disc_intersection** (from, dir, center, radius, normal) : float
  211. Returns the distance along ray (from, dir) to intersection point with disc defined by
  212. *center*, *radius* and *normal* or -1.0 if no intersection.
  213. **ray_sphere_intersection** (from, dir, center, radius) : float
  214. Returns the distance along ray (from, dir) to intersection point with sphere defined by
  215. *center* and *radius* or -1.0 if no intersection.
  216. **ray_obb_intersection** (from, dir, tm, extents) : float
  217. Returns the distance along ray (from, dir) to intersection point with the oriented
  218. bounding box (tm, extents) or -1.0 if no intersection.
  219. World
  220. =====
  221. **spawn_unit** (world, name, [position, rotation]) : Unit
  222. Spawns a new instance of the unit *name* at the given *position* and *rotation*.
  223. **destroy_unit** (world, unit)
  224. Destroys the given *unit*.
  225. **num_units** (world) : int
  226. Returns the number of units in the *world*.
  227. **units** (world) : Table
  228. Returns all the the units in the world in a table.
  229. **update_animations** (world, dt)
  230. Update all animations with *dt*.
  231. **update_scene** (world, dt)
  232. Updates the scene with *dt*.
  233. **update** (world, dt)
  234. Updates the world with *dt*.
  235. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  236. Plays the sound with the given *name* at the given *position*, with the given
  237. *volume* and *range*. *loop* controls whether the sound must loop or not.
  238. **stop_sound** (world, id)
  239. Stops the sound with the given *id*.
  240. **link_sound** (world, id, unit, node)
  241. Links the sound *id* to the *node* of the given *unit*.
  242. After this call, the sound *id* will follow the unit *unit*.
  243. **set_listener_pose** (world, pose)
  244. Sets the *pose* of the listener.
  245. **set_sound_position** (world, position)
  246. Sets the *position* of the sound *id*.
  247. **set_sound_range** (world, range)
  248. Sets the *range* of the sound *id*.
  249. **set_sound_volume** (world, volume)
  250. Sets the *volume* of the sound *id*.
  251. **create_window_gui** (world) : Gui
  252. Creates a new window-space Gui of size *width* and *height*.
  253. **destroy_gui** (world, id)
  254. Destroys the gui with the given *id*.
  255. **create_debug_line** (world, depth_test) : DebugLine
  256. Creates a new DebugLine. *depth_test* controls whether to
  257. enable depth test when rendering the lines.
  258. **destroy_debug_line** (world, line)
  259. Destroys the debug *line*.
  260. **load_level** (world, name) : Level
  261. Loads the level *name* into the world.
  262. **physics_world** (world) : PhysicsWorld
  263. Returns the physics sub-world.
  264. **sound_world** (world) : SoundWorld
  265. Returns the sound sub-world.
  266. Unit
  267. ----
  268. **local_position** (unit) : Vector3
  269. Returns the local position of the unit.
  270. **local_rotation** (unit) : Quaternion
  271. Returns the local rotation of the unit.
  272. **local_scale** (unit) : Vector3
  273. Returns the local scale of the unit.
  274. **local_pose** (unit) : Matrix4x4
  275. Returns the local pose of the unit.
  276. **world_position** (unit) : Vector3
  277. Returns the world position of the unit.
  278. **world_rotation** (unit) : Quaternion
  279. Returns the world rotation of the unit.
  280. **world_pose** (unit) : Matrix4x4
  281. Returns the world pose of the unit.
  282. **set_local_position** (unit, position)
  283. Sets the local position of the unit.
  284. **set_local_rotation** (unit, rotation)
  285. Sets the local rotation of the unit.
  286. **set_local_scale** (unit, scale)
  287. Sets the local scale of the unit.
  288. **set_local_pose** (unit, n, pose)
  289. Sets the local pose of the unit.
  290. **camera** (unit, name)
  291. Returns the camera *name*.
  292. **material** (unit, name)
  293. Returns the material *name*.
  294. **mesh** (unit, name)
  295. Returns the mesh *name*.
  296. **sprite** (unit, name)
  297. Returns the sprite *name*.
  298. **actor** (unit, name)
  299. Returns the actor *name*.
  300. **controller** (unit, name)
  301. Returns the controller *name*.
  302. **is_a** (unit, type)
  303. Returns whether the unit is of the given *type*.
  304. **play_sprite_animation** (unit, name, loop)
  305. Plays the sprite animation *name*.
  306. **stop_sprite_animation** (unit)
  307. Stops the current playing animation.
  308. Camera
  309. ------
  310. **set_projection_type** (camera, type)
  311. Sets the projection type of the camera.
  312. **projection_type** (camera) : int
  313. Returns the projection type of the camera.
  314. **fov** (camera) : float
  315. Returns the field-of-view of the camera in degrees.
  316. **set_fov** (camera, degrees)
  317. Sets the field-of-view of the camera in degrees.
  318. **aspect** (camera) : float
  319. Returns the aspect ratio of the camera. (Perspective projection only.)
  320. **set_aspect** (camera)
  321. Sets the aspect ratio of the camera. (Perspective projection only.)
  322. **near_clip_distance** (camera) : float
  323. Returns the near clip distance of the camera.
  324. **set_near_clip_distance** (camera, near)
  325. Sets the near clip distance of the camera.
  326. **far_clip_distance** (camera) : float
  327. Returns the far clip distance of the camera.
  328. **set_far_clip_distance** (camera, far)
  329. Sets the far clip distance of the camera.
  330. **set_orthographic_metrics** (camera, left, right, bottom, top)
  331. Sets the coordinates for orthographic clipping planes. (Orthographic projection only.)
  332. **set_viewport_metrics** (camera, x, y, width, height)
  333. Sets the coordinates for the camera viewport in pixels.
  334. **screen_to_world** (camera, pos) : Vector3
  335. Returns *pos* from screen-space to world-space coordinates.
  336. **world_to_screen** (camera, pos) : Vector3
  337. Returns *pos* from world-space to screen-space coordinates.
  338. Sprite
  339. ------
  340. **set_frame** (sprite, num)
  341. Sets the frame of the sprite.
  342. **set_depth** (sprite, depth)
  343. Sets the depth of the sprite.
  344. Sprites with higher depth values are drawn in front of sprites
  345. whith lower depth values.
  346. Mesh
  347. ----
  348. **local_position** (mesh) : Vector3
  349. Returns the local position of the mesh.
  350. **local_rotation** (mesh) : Quaternion
  351. Returns the local rotation of the mesh.
  352. **local_pose** (mesh) : Matrix4x4
  353. Returns the local pose of the mesh.
  354. **set_local_position** (mesh, unit, position)
  355. Sets the local position of the mesh.
  356. **set_local_rotation** (mesh, unit, rotation)
  357. Sets the local rotation of the mesh.
  358. **set_local_pose** (mesh, unit, pose)
  359. Sets the local pose of the mesh.
  360. Material
  361. --------
  362. **set_float** (material, variable, value)
  363. Sets the material variable to the given value.
  364. **set_vector2** (material, variable, value)
  365. Sets the material variable to the given value.
  366. **set_vector3** (material, variable, value)
  367. Sets the material variable to the given value.
  368. Gui
  369. ---
  370. resolution
  371. TODO
  372. move
  373. TODO
  374. screen_to_gui
  375. TODO
  376. draw_rectangle
  377. TODO
  378. draw_image
  379. TODO
  380. draw_image_uv
  381. TODO
  382. draw_text
  383. TODO
  384. PhysicsWorld
  385. =============
  386. **gravity** (physics_world) : Vector3
  387. Returns the gravity.
  388. **set_gravity** (physics_world, gravity)
  389. Sets the gravity.
  390. **make_raycast**
  391. TODO
  392. **overlap_test**
  393. TODO
  394. Controller
  395. ----------
  396. **move** (controller, position)
  397. Moves the controller to *position*.
  398. **position** (controller) : Vector3
  399. Returns the position of the controller.
  400. **collides_up** (controller) : bool
  401. Returns whether the contoller collides upwards.
  402. **collides_down** (controller) : bool
  403. Returns whether the controller collides downwards.
  404. **collides_sides** (controller) : bool
  405. Returns whether the controller collides sidewards.
  406. Actor
  407. -----
  408. **world_position** (actor) : Vector3
  409. Returns the world position of the actor.
  410. **world_rotation** (actor) : Quaternion
  411. Returns the world rotation of the actor.
  412. **world_pose** (actor) : Matrix4x4
  413. Returns the world pose of the actor.
  414. **teleport_world_position** (actor, position)
  415. Teleports the actor to the given world position.
  416. **teleport_world_rotation** (actor, rotation)
  417. Teleports the actor to the given world rotation.
  418. **teleport_world_pose** (actor, pose)
  419. Teleports the actor to the given world pose.
  420. **center_of_mass** (actor) : Vector3
  421. Returns the center of mass of the actor.
  422. **enable_gravity** (actor)
  423. Enables gravity for the actor.
  424. **disable_gravity** (actor)
  425. Disables gravity for the actor.
  426. **enable_collision** (actor)
  427. Enables collision detection for the actor.
  428. **disable_collision** (actor)
  429. Disables collision detection for the actor.
  430. **set_collision_filter** (actor, name)
  431. Sets the collision filter of the actor.
  432. **set_kinematic** (actor, kinematic)
  433. Sets whether the actor is kinematic or not.
  434. Note that this call has no effect on static actors.
  435. **move** (actor, position)
  436. Moves the actor to *pos*
  437. Note that this call only affects nonkinematic actors.
  438. **is_static** (actor) : bool
  439. Returns whether the actor is static.
  440. **is_dynamic** (actor) bool
  441. Returns whether the actor is dynamic.
  442. **is_kinematic** (actor) : bool
  443. Returns whether the actor is kinematic (keyframed).
  444. **is_nonkinematic** (actor) : bool
  445. Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
  446. **linear_damping** (actor) : float
  447. Returns the linear damping of the actor.
  448. **set_linear_damping** (actor, damping)
  449. Sets the linear damping of the actor.
  450. **angular_damping** (actor) : float
  451. Returns the angular damping of the actor.
  452. **set_angular_damping** (actor, rate)
  453. Sets the angular damping of the actor.
  454. **linear_velocity** (actor) : Vector3
  455. Returns the linear velocity of the actor.
  456. **set_linear_velocity** (actor, velocity)
  457. Sets the linear velocity of the actor.
  458. Note that this call only affects nonkinematic actors.
  459. **angular_velocity** (actor) : Vector3
  460. Returns the angular velocity of the actor.
  461. **set_angular_velocity** (actor, velocity)
  462. Sets the angular velocity of the actor.
  463. Note that this call only affects nonkinematic actors.
  464. **add_impulse** (actor, impulse)
  465. Adds a linear impulse (acting along the center of mass) to the actor.
  466. Note that this call only affects nonkinematic actors.
  467. **add_impulse_at** (actor, impulse, position)
  468. Adds a linear impulse (acting along the world position *pos*) to the actor.
  469. Note that this call only affects nonkinematic actors.
  470. **add_torque_impulse** (actor, impulse)
  471. Adds a torque impulse to the actor.
  472. **push** (actor, velocity, mass)
  473. Pushes the actor as if it was hit by a point object with the given *mass*
  474. travelling at the given *velocity*.
  475. Note that this call only affects nonkinematic actors.
  476. **push_at** (actor, velocity, mass, position)
  477. Like push() but applies the force at the world position *pos*.
  478. Note that this call only affects nonkinematic actors.
  479. **is_sleeping** (actor) : bool
  480. Returns whether the actor is sleeping.
  481. **wake_up** (actor)
  482. Wakes the actor up.
  483. **unit** (actor) : Unit
  484. Returns the unit that owns the actor or nil;
  485. SoundWorld
  486. ===========
  487. **stop_all** (sound_world)
  488. Stops all the sounds in the world.
  489. **pause_all** (sound_world)
  490. Pauses all the sounds in the world
  491. **resume_all** (sound_world)
  492. Resumes all previously paused sounds in the world.
  493. **is_playing** (sound_world, id) : bool
  494. Returns whether the sound *id* is playing.
  495. ResourcePackage
  496. ================
  497. **load** (package)
  498. Loads all the resources in the package.
  499. Note that the resources are not immediately available after the call is made,
  500. instead, you have to poll for completion with has_loaded().
  501. **unload** (package)
  502. Unloads all the resources in the package.
  503. **flush** (package)
  504. Waits until the package has been loaded.
  505. **has_loaded** (package) : bool
  506. Returns whether the package has been loaded.
  507. Device
  508. ======
  509. **platform** () : string
  510. Returns a string identifying what platform the engine is running on.
  511. It can be either ``android``, ``linux`` or ``windows``
  512. **architecture** () : string
  513. Returns a string identifying what architecture the engine is running on.
  514. **version** () : string
  515. Returns a string identifying the engine version.
  516. **last_delta_time** () : float
  517. Returns the time in seconds needed to render the last frame
  518. **quit** ()
  519. Quits the application.
  520. **resolution** () : Table
  521. Returns the main window resolution.
  522. **create_world** () : World
  523. Creates a new world.
  524. **destroy_world** (world)
  525. Destroys the given *world*.
  526. **render_world** (world, camera)
  527. Renders the given *world* from the point of view of the given *camera*.
  528. **create_resource_package** (name) : ResourcePackage
  529. Returns the resource package with the given *package_name* name.
  530. **destroy_resource_package** (package)
  531. Destroy a previously created resource *package*.
  532. Note that to unload the resources loaded by the package, you have to call
  533. ResourcePackage.unload() first.
  534. **console_send** (table)
  535. Sends the given lua *table* to clients connected to the engine.
  536. Note that the current version only supports explicitly escaped strings as key/value pairs.
  537. **can_get** (type, name) : bool
  538. Returns whether the resource (type, name) is loaded.
  539. When resource autoload is enabled it always returns true.
  540. **enable_resource_autoload** (enable)
  541. Sets whether resources should be automatically loaded when accessed.
  542. DebugLine
  543. =========
  544. **add_line** (debug_line, start, end, color)
  545. Adds a line from *start* to *end* with the given *color*.
  546. **add_axes** (debug_line, tm, length)
  547. Adds lines for each axis with the given *length*.
  548. **add_circle** (debug_line, center, radius, normal, color, [segments = 36])
  549. Adds a circle at *center* with the given *radius* and *normal* vector.
  550. **add_cone** (debug_line, from, to, radius, color, [segments = 36])
  551. Adds a cone with the base centered at *from* and the tip at *to*.
  552. **add_sphere** (debug_line, center, radius, color, [segments = 36])
  553. Adds a sphere at *center* with the given *radius*.
  554. **add_obb** (debug_line, tm, extents, color)
  555. Adds an orientd bounding box. *tm* describes the position and orientation of
  556. the box. *extents* describes the size of the box along the axis.
  557. **reset** (debug_line)
  558. Resets all the lines.
  559. **submit** (debug_line)
  560. Submits the lines to renderer for drawing.
  561. Input
  562. =====
  563. Keyboard
  564. --------
  565. **name** () : string
  566. Returns the name of the input device.
  567. **connected** () : bool
  568. Returns whether the input device is connected and functioning.
  569. **num_buttons** () : int
  570. Returns the number of buttons of the input device.
  571. **num_axes** () : int
  572. Returns the number of axes of the input device.
  573. **pressed** (id) : bool
  574. Returns whether the button *id* is pressed in the current frame.
  575. **released** (id) : bool
  576. Returns whether the button *id* is released in the current frame.
  577. **any_pressed** () : bool
  578. Returns whether any button is pressed in the current frame.
  579. **any_released** () : bool
  580. Returns whether any button is released in the current frame.
  581. **button_id** (name) : int
  582. Returns the *id* of the button *name*.
  583. Keyboard Button Names
  584. ~~~~~~~~~~~~~~~~~~~~~
  585. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  586. * ``num_lock``, ``numpad_enter``, ``numpad_.``, ``numpad_*``, ``numpad_+``, ``numpad_-``, ``numpad_/``, ``numpad_0``, ``numpad_1``, ``numpad_2``, ``numpad_3``, ``numpad_4``, ``numpad_5``, ``numpad_6``, ``numpad_7``, ``numpad_8``, ``numpad_9``
  587. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  588. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``delete``, ``end``
  589. * ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
  590. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  591. * ``a``, ``b``, ``c``, ``d``, ``e``, ``f``, ``g``, ``h``, ``i``, ``j``, ``k``, ``l``, ``m``, ``n``, ``o``, ``p``, ``q``, ``r``, ``s``, ``t``, ``u``, ``v``, ``w``, ``x``, ``y``, ``z``
  592. Keyboard Axis Names
  593. ~~~~~~~~~~~~~~~~~~~
  594. None.
  595. Mouse
  596. -----
  597. **name** () : string
  598. Returns the name of the input device.
  599. **connected** () : bool
  600. Returns whether the input device is connected and functioning.
  601. **num_buttons** () : int
  602. Returns the number of buttons of the input device.
  603. **num_axes** () : int
  604. Returns the number of axes of the input device.
  605. **pressed** (id) : bool
  606. Returns whether the button *id* is pressed in the current frame.
  607. **released** (id) : bool
  608. Returns whether the button *id* is released in the current frame.
  609. **any_pressed** () : bool
  610. Returns whether any button is pressed in the current frame.
  611. **any_released** () : bool
  612. Returns whether any button is released in the current frame.
  613. **axis** (id) : Vector3
  614. Returns the value of the axis *id*.
  615. **button_id** (name) : int
  616. Returns the *id* of the button *name*.
  617. **axis_id** (name) : int
  618. Returns the *id* of the axis *name*.
  619. Mouse Button Names
  620. ~~~~~~~~~~~~~~~~~~
  621. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  622. Mouse Axis Names
  623. ~~~~~~~~~~~~~~~~
  624. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  625. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  626. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  627. Touch
  628. -----
  629. **name** () : string
  630. Returns the name of the input device.
  631. **connected** () : bool
  632. Returns whether the input device is connected and functioning.
  633. **num_buttons** () : int
  634. Returns the number of buttons of the input device.
  635. **num_axes** () : int
  636. Returns the number of axes of the input device.
  637. **pressed** (id) : bool
  638. Returns whether the button *id* is pressed in the current frame.
  639. **released** (id) : bool
  640. Returns whether the button *id* is released in the current frame.
  641. **any_pressed** () : bool
  642. Returns whether any button is pressed in the current frame.
  643. **any_released** () : bool
  644. Returns whether any button is released in the current frame.
  645. **axis** (id) : Vector3
  646. Returns the value of the axis *id*.
  647. Pad1, Pad2, Pad3, Pad4
  648. ----------------------
  649. **name** () : string
  650. Returns the name of the input device.
  651. **connected** () : bool
  652. Returns whether the input device is connected and functioning.
  653. **num_buttons** () : int
  654. Returns the number of buttons of the input device.
  655. **num_axes** () : int
  656. Returns the number of axes of the input device.
  657. **pressed** (id) : bool
  658. Returns whether the button *id* is pressed in the current frame.
  659. **released** (id) : bool
  660. Returns whether the button *id* is released in the current frame.
  661. **any_pressed** () : bool
  662. Returns whether any button is pressed in the current frame.
  663. **any_released** () : bool
  664. Returns whether any button is released in the current frame.
  665. **axis** (id) : Vector3
  666. Returns the value of the axis *id*.
  667. **button_id** (name) : int
  668. Returns the *id* of the button *name*.
  669. **axis_id** (name) : int
  670. Returns the *id* of the axis *name*.
  671. Pad Button Names
  672. ~~~~~~~~~~~~~~~~
  673. * ``up``, ``down``, ``left``, ``right``
  674. * ``start``, ``back``, ``guide``
  675. * ``left_thumb``, ``right_thumb``
  676. * ``left_shoulder``, ``right_shoulder``
  677. * ``a``, ``b``, ``x``, ``y``
  678. Pad Axis Names
  679. ~~~~~~~~~~~~~~
  680. * ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z component represents the left or right trigger [0; +1].
  681. Window
  682. ======
  683. **show** ()
  684. Shows the window.
  685. **hide** ()
  686. Hides the window.
  687. **resize** (width, height)
  688. Resizes the window to *width* and *height*.
  689. **move** (x, y)
  690. Moves the window to *x* and *y*.
  691. **minimize** ()
  692. Minimizes the window.
  693. **restore** ()
  694. Restores the window.
  695. **is_resizable** () : bool
  696. Returns whether the window is resizable.
  697. **set_resizable** (resizable)
  698. Sets whether the window is resizable.
  699. **title** () : string
  700. Returns the title of the window.
  701. **set_title** (title)
  702. Sets the title of the window.