lua_api.txt 26 KB

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