lua_api.txt 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. .. contents::
  2. Math
  3. ====
  4. Vector3
  5. -------
  6. **Vector3** (x, y, z) : Vector3
  7. Returns a new vector from individual elements.
  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 element from *a* and *b*.
  56. **min** (a, b) : Vector3
  57. Returns a vector that contains the smallest value for each element 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 initialized with the zero vector.
  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 individual elements.
  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 initialized with the identity quaternion.
  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 individual 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 elements.
  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** () : Matrix4x4Box
  194. Returns a new Matrix4x4Box initialized with the identity matrix.
  195. **Matrix4x4Box** (m) : Matrix4x4Box
  196. Returns a new Matrix4x4Box from the Matrix4x4 *m*.
  197. **store** (m)
  198. Stores the Matrix4x4 *m* in the box.
  199. **unbox** () : Matrix4x4
  200. Returns the stored matrix from the box.
  201. Color4
  202. ------
  203. **Color4** (r, g, b, a) : Color4
  204. Returns a new Color4 from individual elements.
  205. | **black** () : Color4
  206. | **white** () : Color4
  207. | **red** () : Color4
  208. | **green** () : Color4
  209. | **blue** () : Color4
  210. | **yellow** () : Color4
  211. | **orange** () : Color4
  212. | Returns the corresponding mnemonic color.
  213. **to_string** (c) : string
  214. Returns a string representing the color *c*.
  215. Math
  216. ----
  217. **ray_plane_intersection** (from, dir, point, normal) : float
  218. Returns the distance along ray (from, dir) to intersection point with plane defined by
  219. *point* and *normal* or -1.0 if no intersection.
  220. **ray_disc_intersection** (from, dir, center, radius, normal) : float
  221. Returns the distance along ray (from, dir) to intersection point with disc defined by
  222. *center*, *radius* and *normal* or -1.0 if no intersection.
  223. **ray_sphere_intersection** (from, dir, center, radius) : float
  224. Returns the distance along ray (from, dir) to intersection point with sphere defined by
  225. *center* and *radius* or -1.0 if no intersection.
  226. **ray_obb_intersection** (from, dir, tm, half_extents) : float
  227. Returns the distance along ray (from, dir) to intersection point with the oriented
  228. bounding box (tm, half_extents) or -1.0 if no intersection.
  229. UnitManager
  230. ===========
  231. **create** ([world]) : Unit
  232. Creates a new empty unit. If *world* is specified, the unit will be owned by
  233. that world.
  234. **destroy** (unit)
  235. Destroys the given *unit*.
  236. **alive** (unit) : bool
  237. Returns whether the unit is alive.
  238. World
  239. =====
  240. **spawn_unit** (world, name, [position, rotation]) : Unit
  241. Spawns a new instance of the unit *name* at the given *position* and *rotation*.
  242. **destroy_unit** (world, unit)
  243. Destroys the given *unit*.
  244. **num_units** (world) : int
  245. Returns the number of units in the *world*.
  246. **units** (world) : table
  247. Returns all the the units in the world in a table.
  248. **update_animations** (world, dt)
  249. Update all animations with *dt*.
  250. **update_scene** (world, dt)
  251. Updates the scene with *dt*.
  252. **update** (world, dt)
  253. Updates the world with *dt*.
  254. **create_debug_line** (world, depth_test) : DebugLine
  255. Creates a new DebugLine. *depth_test* controls whether to
  256. enable depth test when rendering the lines.
  257. **destroy_debug_line** (world, line)
  258. Destroys the debug *line*.
  259. **scene_graph** (world) : SceneGraph
  260. Returns the scene graph.
  261. **render_world** (world) : RenderWorld
  262. Returns the render sub-world.
  263. **physics_world** (world) : PhysicsWorld
  264. Returns the physics sub-world.
  265. **sound_world** (world) : SoundWorld
  266. Returns the sound sub-world.
  267. Sound
  268. -----
  269. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  270. Plays the sound with the given *name* at the given *position*, with the given
  271. *volume* and *range*. *loop* controls whether the sound must loop or not.
  272. **stop_sound** (world, id)
  273. Stops the sound with the given *id*.
  274. **link_sound** (world, id, unit, node)
  275. Links the sound *id* to the *node* of the given *unit*.
  276. After this call, the sound *id* will follow the unit *unit*.
  277. **set_listener_pose** (world, pose)
  278. Sets the *pose* of the listener.
  279. **set_sound_position** (world, id, position)
  280. Sets the *position* of the sound *id*.
  281. **set_sound_range** (world, id, range)
  282. Sets the *range* of the sound *id*.
  283. **set_sound_volume** (world, id, volume)
  284. Sets the *volume* of the sound *id*.
  285. Level
  286. -----
  287. **load_level** (world, name, [pos, rot]) : Level
  288. Loads the level *name* into the world at the given *position* and *rotation*.
  289. SceneGraph
  290. ==========
  291. **create** (sg, unit) : int
  292. Creates the transform for the *unit*.
  293. **destroy** (sg, id)
  294. Destroys the transform *id*.
  295. **transform_instances** (sg, unit) : Id
  296. Returns the transform of the *unit*.
  297. **local_position** (sg, id) : Vector3
  298. Returns the local position of the transform *id*.
  299. **local_rotation** (sg, id) : Quaternion
  300. Returns the local rotation of the transform *id*.
  301. **local_scale** (sg, id) : Vector3
  302. Returns the local scale of the transform *id*.
  303. **local_pose** (sg, id) : Matrix4x4
  304. Returns the local pose of the transform *id*.
  305. **world_position** (sg, id) : Vector3
  306. Returns the world position of the transform *id*.
  307. **world_rotation** (sg, id) : Quaternion
  308. Returns the world rotation of the transform *id*.
  309. **world_pose** (sg, id) : Matrix4x4
  310. Returns the world pose of the transform *id*.
  311. **set_local_position** (sg, id, position)
  312. Sets the local *position* of the transform *id*.
  313. **set_local_rotation** (sg, id, rotation)
  314. Sets the local *rotation* of the transform *id*.
  315. **set_local_scale** (sg, id, scale)
  316. Sets the local *scale* of the transform *id*.
  317. **set_local_pose** (sg, id, pose)
  318. Sets the local *pose* of the transform *id*.
  319. **link** (sg, child, parent)
  320. Links *child* transform to *parent* transform.
  321. **unlink** (sg, id)
  322. Unlinks *id* transform from its parent, if any.
  323. Material
  324. ========
  325. **set_float** (material, variable, value)
  326. Sets the material variable to the given value.
  327. **set_vector2** (material, variable, value)
  328. Sets the material variable to the given value.
  329. **set_vector3** (material, variable, value)
  330. Sets the material variable to the given value.
  331. Gui
  332. ===
  333. **rect** (pos, size, material_resource, color)
  334. Draws a rectangle.
  335. **image** (pos, size, material_resource, color)
  336. Draws an image.
  337. **image_uv** (pos, size, uv0, uv1, material_resource, color)
  338. Draws an image with explicit UV coordinates.
  339. **text** (pos, font_size, str, font_resource, material_resource, color)
  340. Draws text.
  341. RenderWorld
  342. ===========
  343. **enable_debug_drawing** (rw, enable)
  344. Sets whether to *enable* debug drawing.
  345. Mesh
  346. ----
  347. **create_mesh** (rw, unit, mesh_resource, geometry_name, material_resource, visible) : Id
  348. Creates a new mesh instance for *unit* and returns its id.
  349. **destroy_mesh** (rw, id)
  350. Destroys the mesh *id*.
  351. **mesh_instances** (rw, unit) : table
  352. Returns all the mesh instances of the *unit*.
  353. Sprite
  354. ------
  355. **create_sprite** (rw, unit, sprite_resource, material_resource, visible) : Id
  356. Creates a new sprite instance for *unit* and returns its id.
  357. **destroy_sprite** (rw, id)
  358. Destroys the sprite *id*.
  359. **sprite_instances** (rw, unit) : table
  360. Returns all the sprites of the *unit*.
  361. Light
  362. -----
  363. **create_light** (rw, unit, type, range, intensity, spot_angle, color) : Id
  364. Creates a new light for *unit* and returns its id.
  365. Type can be either ``directional``, ``omni`` or ``spot``.
  366. **destroy_light** (rw, id)
  367. Destroys the light *id*.
  368. **light_instances** (rw, unit) : Id
  369. Returns the light of the *unit*.
  370. **light_type** (rw, id) : string
  371. Returns the type of the light *id*.
  372. It can be either ``directional``, ``omni`` or ``spot``.
  373. **light_color** (rw, id) : Color4
  374. Returns the color of the light *id*.
  375. **light_range** (rw, id) : float
  376. Returns the range of the light *id*.
  377. **light_intensity** (rw, id) : float
  378. Returns the intensity of the light *id*.
  379. **light_spot_angle** (rw, id) : float
  380. Returns the spot angle of the light *id*.
  381. **set_light_type** (rw, id, type)
  382. Sets the *type* of the light *id*.
  383. **set_light_color** (rw, id, color)
  384. Sets the *color* of the light *id*.
  385. **set_light_range** (rw, id, range)
  386. Sets the *range* of the light *id*.
  387. **set_light_intensity** (rw, id, intensity)
  388. Sets the *intensity* of the light *id*.
  389. **set_light_spot_angle** (rw, id, angle)
  390. Sets the spot *angle* of the light *id*.
  391. PhysicsWorld
  392. =============
  393. **gravity** (pw) : Vector3
  394. Returns the gravity.
  395. **set_gravity** (pw, gravity)
  396. Sets the gravity.
  397. **raycast** (pw, from, dir, length, mode) : table
  398. Returns the actors which intersects the raycast.
  399. Mode can be either ``closest`` or ``all``.
  400. **enable_debug_drawing** (pw, enable)
  401. Sets whether to *enable* debug drawing.
  402. Actor
  403. -----
  404. **actor_instances** (pw, unit) : Id
  405. Returns the actor of the *unit*.
  406. **actor_world_position** (pw, actor) : Vector3
  407. Returns the world position of the actor.
  408. **actor_world_rotation** (pw, actor) : Quaternion
  409. Returns the world rotation of the actor.
  410. **actor_world_pose** (pw, actor) : Matrix4x4
  411. Returns the world pose of the actor.
  412. **teleport_actor_world_position** (pw, actor, position)
  413. Teleports the actor to the given world position.
  414. **teleport_actor_world_rotation** (pw, actor, rotation)
  415. Teleports the actor to the given world rotation.
  416. **teleport_actor_world_pose** (pw, actor, pose)
  417. Teleports the actor to the given world pose.
  418. **actor_center_of_mass** (pw, actor) : Vector3
  419. Returns the center of mass of the actor.
  420. **enable_actor_gravity** (pw, actor)
  421. Enables gravity for the actor.
  422. **disable_actor_gravity** (pw, actor)
  423. Disables gravity for the actor.
  424. **enable_actor_collision** (pw, actor)
  425. Enables collision detection for the actor.
  426. **disable_actor_collision** (pw, actor)
  427. Disables collision detection for the actor.
  428. **set_actor_collision_filter** (pw, actor, name)
  429. Sets the collision filter of the actor.
  430. **set_actor_kinematic** (pw, actor, kinematic)
  431. Sets whether the actor is kinematic or not.
  432. Note that this call has no effect on static actors.
  433. **move_actor** (pw, actor, position)
  434. Moves the actor to *pos*
  435. Note that this call only affects nonkinematic actors.
  436. **is_static** (pw, actor) : bool
  437. Returns whether the actor is static.
  438. **is_dynamic** (pw, actor) bool
  439. Returns whether the actor is dynamic.
  440. **is_kinematic** (pw, actor) : bool
  441. Returns whether the actor is kinematic (keyframed).
  442. **is_nonkinematic** (pw, actor) : bool
  443. Returns whether the actor is nonkinematic (i.e. dynamic and not kinematic).
  444. **actor_linear_damping** (pw, actor) : float
  445. Returns the linear damping of the actor.
  446. **set_actor_linear_damping** (pw, actor, damping)
  447. Sets the linear damping of the actor.
  448. **actor_angular_damping** (pw, actor) : float
  449. Returns the angular damping of the actor.
  450. **set_actor_angular_damping** (pw, actor, rate)
  451. Sets the angular damping of the actor.
  452. **actor_linear_velocity** (pw, actor) : Vector3
  453. Returns the linear velocity of the actor.
  454. **set_actor_linear_velocity** (pw, actor, velocity)
  455. Sets the linear velocity of the actor.
  456. Note that this call only affects nonkinematic actors.
  457. **actor_angular_velocity** (pw, actor) : Vector3
  458. Returns the angular velocity of the actor.
  459. **set_actor_angular_velocity** (pw, actor, velocity)
  460. Sets the angular velocity of the actor.
  461. Note that this call only affects nonkinematic actors.
  462. **add_actor_impulse** (pw, actor, impulse)
  463. Adds a linear impulse (acting along the center of mass) to the actor.
  464. Note that this call only affects nonkinematic actors.
  465. **add_actor_impulse_at** (pw, actor, impulse, position)
  466. Adds a linear impulse (acting along the world position *pos*) to the actor.
  467. Note that this call only affects nonkinematic actors.
  468. **add_actor_torque_impulse** (pw, actor, impulse)
  469. Adds a torque impulse to the actor.
  470. **push_actor** (pw, actor, velocity, mass)
  471. Pushes the actor as if it was hit by a point object with the given *mass*
  472. travelling at the given *velocity*.
  473. Note that this call only affects nonkinematic actors.
  474. **push_actor_at** (pw, actor, velocity, mass, position)
  475. Like push() but applies the force at the world position *pos*.
  476. Note that this call only affects nonkinematic actors.
  477. **is_sleeping** (pw, actor) : bool
  478. Returns whether the actor is sleeping.
  479. **wake_up** (pw, actor)
  480. Wakes the actor up.
  481. SoundWorld
  482. ===========
  483. **stop_all** (sound_world)
  484. Stops all the sounds in the world.
  485. **pause_all** (sound_world)
  486. Pauses all the sounds in the world
  487. **resume_all** (sound_world)
  488. Resumes all previously paused sounds in the world.
  489. **is_playing** (sound_world, id) : bool
  490. Returns whether the sound *id* is playing.
  491. ResourcePackage
  492. ================
  493. **load** (package)
  494. Loads all the resources in the package.
  495. Note that the resources are not immediately available after the call is made,
  496. instead, you have to poll for completion with has_loaded().
  497. **unload** (package)
  498. Unloads all the resources in the package.
  499. **flush** (package)
  500. Waits until the package has been loaded.
  501. **has_loaded** (package) : bool
  502. Returns whether the package has been loaded.
  503. Device
  504. ======
  505. **argv** () : table
  506. Returns a table containing the command line parameters the engine was started with.
  507. **platform** () : string
  508. Returns a string identifying what platform the engine is running on.
  509. It can be either ``android``, ``linux`` or ``windows``
  510. **architecture** () : string
  511. Returns a string identifying what architecture the engine is running on.
  512. It can be either ``32-bit`` or ``64-bit``.
  513. **version** () : string
  514. Returns a string identifying the engine version.
  515. The form is "major.minor.micro".
  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** () : float, float
  521. Returns the main window resolution (width, height).
  522. **create_world** () : World
  523. Creates a new world.
  524. **destroy_world** (world)
  525. Destroys the given *world*.
  526. **render** (world, camera)
  527. Renders *world* using *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, half_extents, color)
  555. Adds an orientd bounding box. *tm* describes the position and orientation of
  556. the box. *half_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 keyboard.
  567. **connected** () : bool
  568. Returns whether the keyboard is connected and functioning.
  569. **num_buttons** () : int
  570. Returns the number of buttons of the keyboard.
  571. **num_axes** () : int
  572. Returns the number of axes of the keyboard.
  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_name** (id) : string
  582. Returns the name of the button *id*.
  583. **button_id** (name) : int
  584. Returns the *id* of the button *name*.
  585. Keyboard Button Names
  586. ~~~~~~~~~~~~~~~~~~~~~
  587. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  588. * ``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``
  589. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  590. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``insert``, ``delete``, ``end``
  591. * ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
  592. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  593. * ``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``
  594. Keyboard Axis Names
  595. ~~~~~~~~~~~~~~~~~~~
  596. None.
  597. Mouse
  598. -----
  599. **name** () : string
  600. Returns the name of the mouse.
  601. **connected** () : bool
  602. Returns whether the mouse is connected and functioning.
  603. **num_buttons** () : int
  604. Returns the number of buttons of the mouse.
  605. **num_axes** () : int
  606. Returns the number of axes of the mouse.
  607. **pressed** (id) : bool
  608. Returns whether the button *id* is pressed in the current frame.
  609. **released** (id) : bool
  610. Returns whether the button *id* is released in the current frame.
  611. **any_pressed** () : bool
  612. Returns whether any button is pressed in the current frame.
  613. **any_released** () : bool
  614. Returns whether any button is released in the current frame.
  615. **axis** (id) : Vector3
  616. Returns the value of the axis *id*.
  617. **button_name** (id) : string
  618. Returns the name of the button *id*.
  619. **axis_name** (id) : string
  620. Returns the name of the axis *id*.
  621. **button_id** (name) : int
  622. Returns the *id* of the button *name*.
  623. **axis_id** (name) : int
  624. Returns the *id* of the axis *name*.
  625. Mouse Button Names
  626. ~~~~~~~~~~~~~~~~~~
  627. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  628. Mouse Axis Names
  629. ~~~~~~~~~~~~~~~~
  630. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  631. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  632. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  633. Touch
  634. -----
  635. **name** () : string
  636. Returns the name of the touch.
  637. **connected** () : bool
  638. Returns whether the touch is connected and functioning.
  639. **num_buttons** () : int
  640. Returns the number of buttons of the touch.
  641. **num_axes** () : int
  642. Returns the number of axes of the touch.
  643. **pressed** (id) : bool
  644. Returns whether the button *id* is pressed in the current frame.
  645. **released** (id) : bool
  646. Returns whether the button *id* is released in the current frame.
  647. **any_pressed** () : bool
  648. Returns whether any button is pressed in the current frame.
  649. **any_released** () : bool
  650. Returns whether any button is released in the current frame.
  651. **axis** (id) : Vector3
  652. Returns the value of the axis *id*.
  653. **button_name** (id) : string
  654. Returns the name of the button *id*.
  655. **axis_name** (id) : string
  656. Returns the name of the axis *id*.
  657. **button_id** (name) : int
  658. Returns the *id* of the button *name*.
  659. **axis_id** (name) : int
  660. Returns the *id* of the axis *name*.
  661. Pad1, Pad2, Pad3, Pad4
  662. ----------------------
  663. **name** () : string
  664. Returns the name of the pad.
  665. **connected** () : bool
  666. Returns whether the pad is connected and functioning.
  667. **num_buttons** () : int
  668. Returns the number of buttons of the pad.
  669. **num_axes** () : int
  670. Returns the number of axes of the pad.
  671. **pressed** (id) : bool
  672. Returns whether the button *id* is pressed in the current frame.
  673. **released** (id) : bool
  674. Returns whether the button *id* is released in the current frame.
  675. **any_pressed** () : bool
  676. Returns whether any button is pressed in the current frame.
  677. **any_released** () : bool
  678. Returns whether any button is released in the current frame.
  679. **axis** (id) : Vector3
  680. Returns the value of the axis *id*.
  681. **button_name** (id) : string
  682. Returns the name of the button *id*.
  683. **axis_name** (id) : string
  684. Returns the name of the axis *id*.
  685. **button_id** (name) : int
  686. Returns the *id* of the button *name*.
  687. **axis_id** (name) : int
  688. Returns the *id* of the axis *name*.
  689. Pad Button Names
  690. ~~~~~~~~~~~~~~~~
  691. * ``up``, ``down``, ``left``, ``right``
  692. * ``start``, ``back``, ``guide``
  693. * ``left_thumb``, ``right_thumb``
  694. * ``left_shoulder``, ``right_shoulder``
  695. * ``a``, ``b``, ``x``, ``y``
  696. Pad Axis Names
  697. ~~~~~~~~~~~~~~
  698. * ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z element represents the left or right trigger [0; +1].
  699. Profiler
  700. ========
  701. **enter_scope** (name)
  702. Starts a new profile scope with the given *name*.
  703. **leave_scope** ()
  704. Ends the last profile scope.
  705. **record** (name, value)
  706. Records *value* with the given *name*. Value can be either number or Vector3.
  707. Display
  708. =======
  709. **modes** () : table
  710. Returns an array of display modes. See `Display Mode`_.
  711. **set_mode** (id)
  712. Sets the display mode *id*.
  713. The initial display mode is automatically reset when the program terminates.
  714. Display Mode
  715. ------------
  716. Display mode is a lua table with 3 fields:
  717. * ``id``: The id of the display mode.
  718. * ``width``: The width of the display mode.
  719. * ``height``: The height of the display mode.
  720. Window
  721. ======
  722. **show** ()
  723. Shows the window.
  724. **hide** ()
  725. Hides the window.
  726. **resize** (width, height)
  727. Resizes the window to *width* and *height*.
  728. **move** (x, y)
  729. Moves the window to *x* and *y*.
  730. **minimize** ()
  731. Minimizes the window.
  732. **restore** ()
  733. Restores the window.
  734. **title** () : string
  735. Returns the title of the window.
  736. **set_title** (title)
  737. Sets the title of the window.
  738. **show_cursor** (show)
  739. Sets whether to *show* the cursor.