lua_api.txt 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. =================
  2. Lua API reference
  3. =================
  4. AnimationStateMachine
  5. =====================
  6. **instance** (asm, unit) : Id
  7. Returns the ID of the state machine owned by the *unit*, or ``nil``.
  8. **variable_id** (asm, state_machine, name) : Id
  9. Returns the ID of the variable *name* in the *state_machine*.
  10. **variable** (asm, state_machine, variable_id) : number
  11. Returns the value of the *variable_id* in the *state_machine*.
  12. **set_variable** (asm, state_machine, variable_id, value)
  13. Sets the *value* of the *variable_id* in the *state_machine*.
  14. **trigger** (asm, state_machine, event)
  15. Triggers the *event* in the *state_machine*.
  16. DebugLine
  17. =========
  18. **add_line** (debug_line, start, end, color)
  19. Adds a line from *start* to *end* with the given *color*.
  20. **add_axes** (debug_line, tm, length)
  21. Adds lines for each axis with the given *length*.
  22. **add_arc** (debug_line, center, radius, plane_normal, midpoint_normal, color, [circle_segments = 36]);
  23. Adds an arc at *center* with the given *radius* and *plane_normal* and *midpoint_normal* vectors.
  24. **add_circle** (debug_line, center, radius, normal, color, [segments = 36])
  25. Adds a circle at *center* with the given *radius* and *normal* vector.
  26. **add_cone** (debug_line, from, to, radius, color, [segments = 36])
  27. Adds a cone with the base centered at *from* and the tip at *to*.
  28. **add_sphere** (debug_line, center, radius, color, [segments = 36])
  29. Adds a sphere at *center* with the given *radius*.
  30. **add_obb** (debug_line, tm, half_extents, color)
  31. Adds an orientd bounding box. *tm* describes the position and orientation of
  32. the box. *half_extents* describes the size of the box along the axis.
  33. **add_frustum** (debug_line, mvp, color)
  34. Adds a frustum defined by *mvp*.
  35. **reset** (debug_line)
  36. Resets all the lines.
  37. **submit** (debug_line)
  38. Submits the lines to renderer for drawing.
  39. Device
  40. ======
  41. **argv** () : table
  42. Returns a table containing the command line parameters the engine was started with.
  43. **platform** () : string
  44. Returns a string identifying what platform the engine is running on.
  45. It can be either ``android``, ``linux`` or ``windows``
  46. **architecture** () : string
  47. Returns a string identifying what architecture the engine is running on.
  48. It can be either ``32-bit`` or ``64-bit``.
  49. **version** () : string
  50. Returns a string identifying the engine version.
  51. The form is "major.minor.micro".
  52. **quit** ()
  53. Quits the application.
  54. **resolution** () : float, float
  55. Returns the main window resolution (width, height).
  56. **create_world** () : World
  57. Creates a new world.
  58. **destroy_world** (world)
  59. Destroys the given *world*.
  60. **render** (world, camera)
  61. Renders *world* using *camera*.
  62. **create_resource_package** (name) : ResourcePackage
  63. Returns the resource package with the given *package_name* name.
  64. **destroy_resource_package** (package)
  65. Destroy a previously created resource *package*.
  66. .. note::
  67. To unload the resources loaded by the package, you have to call
  68. ResourcePackage.unload() first.
  69. **console_send** (table)
  70. Sends the given lua *table* to clients connected to the engine.
  71. Values can be either ``nil``, bool, number, string, table, array, Vector2, Vector3, Quaternion, Matrix4x4 or Color4.
  72. **can_get** (type, name) : bool
  73. Returns whether the resource (type, name) is loaded.
  74. When resource autoload is enabled it always returns true.
  75. **enable_resource_autoload** (enable)
  76. Sets whether resources should be automatically loaded when accessed.
  77. **temp_count** () : int, int, int
  78. Returns the number of temporary objects used by Lua.
  79. **set_temp_count** (nv, nq, nm)
  80. Sets the number of temporary objects used by Lua.
  81. **guid** () : string
  82. Returns a new GUID.
  83. Display
  84. =======
  85. **modes** () : table
  86. Returns an array of `DisplayMode`_ tables.
  87. **set_mode** (id)
  88. Sets the display mode *id*.
  89. The initial display mode is automatically reset when the program terminates.
  90. DisplayMode
  91. -----------
  92. DisplayMode is a lua table with 3 fields:
  93. * ``id``: The id of the display mode.
  94. * ``width``: The width of the display mode.
  95. * ``height``: The height of the display mode.
  96. Gui
  97. ===
  98. **move** (gui, pos)
  99. Moves the Gui to *pos*.
  100. **triangle** (gui, a, b, c, color)
  101. Draws a triangle defined by vertices *a*, *b* and *c*.
  102. **rect** (gui, pos, size, color)
  103. Draws a rectangle.
  104. **image** (gui, pos, size, material_resource, color)
  105. Draws an image.
  106. **image_uv** (gui, pos, size, uv0, uv1, material_resource, color)
  107. Draws an image with explicit UV coordinates.
  108. **text** (gui, pos, font_size, str, font_resource, material_resource, color)
  109. Draws text.
  110. Input
  111. =====
  112. Keyboard
  113. --------
  114. **name** () : string
  115. Returns the name of keyboard.
  116. **connected** () : bool
  117. Returns whether the keyboard is connected and functioning.
  118. **num_buttons** () : int
  119. Returns the number of buttons of the keyboard.
  120. **num_axes** () : int
  121. Returns the number of axes of the keyboard.
  122. **pressed** (id) : bool
  123. Returns whether the button *id* is pressed in the current frame.
  124. **released** (id) : bool
  125. Returns whether the button *id* is released in the current frame.
  126. **any_pressed** () : bool
  127. Returns the *id* of the first button that was pressed in the current frame
  128. or ``nil`` if no buttons were pressed at all.
  129. **any_released** () : bool
  130. Returns the *id* of the first button that was released in the current frame
  131. or ``nil`` if no buttons were released at all.
  132. **button** (id) : float
  133. Returns the value of the button *id* in the range [0..1].
  134. **button_name** (id) : string
  135. Returns the name of the button *id*.
  136. **button_id** (name) : int
  137. Returns the *id* of the button *name* or ``nil`` if no matching button is found.
  138. Keyboard Button Names
  139. ~~~~~~~~~~~~~~~~~~~~~
  140. * ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
  141. * ``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``
  142. * ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
  143. * ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``ins``, ``del``, ``end``
  144. * ``ctrl_left``, ``ctrl_right``, ``shift_left``, ``shift_right``, ``caps_lock``, ``alt_left``, ``alt_right``, ``super_left``, ``super_right``
  145. * ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
  146. * ``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``
  147. Keyboard Axis Names
  148. ~~~~~~~~~~~~~~~~~~~
  149. None.
  150. Mouse
  151. -----
  152. **name** () : string
  153. Returns the name of the mouse.
  154. **connected** () : bool
  155. Returns whether the mouse is connected and functioning.
  156. **num_buttons** () : int
  157. Returns the number of buttons of the mouse.
  158. **num_axes** () : int
  159. Returns the number of axes of the mouse.
  160. **pressed** (id) : bool
  161. Returns whether the button *id* is pressed in the current frame.
  162. **released** (id) : bool
  163. Returns whether the button *id* is released in the current frame.
  164. **any_pressed** () : bool
  165. Returns the *id* of the first button that was pressed in the current frame
  166. or ``nil`` if no buttons were pressed at all.
  167. **any_released** () : bool
  168. Returns the *id* of the first button that was released in the current frame
  169. or ``nil`` if no buttons were released at all.
  170. **button** (id) : float
  171. Returns the value of the button *id* in the range [0..1].
  172. **axis** (id) : Vector3
  173. Returns the value of the axis *id*.
  174. **button_name** (id) : string
  175. Returns the name of the button *id*.
  176. **axis_name** (id) : string
  177. Returns the name of the axis *id*.
  178. **button_id** (name) : int
  179. Returns the *id* of the button *name* or ``nil`` if no matching button is found.
  180. **axis_id** (name) : int
  181. Returns the *id* of the axis *name* or ``nil`` if no matching axis is found.
  182. Mouse Button Names
  183. ~~~~~~~~~~~~~~~~~~
  184. ``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
  185. Mouse Axis Names
  186. ~~~~~~~~~~~~~~~~
  187. * ``cursor``: Returns the cursor position (x, y) in screen coordinates.
  188. * ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
  189. * ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
  190. Touch
  191. -----
  192. **name** () : string
  193. Returns the name of the touch.
  194. **connected** () : bool
  195. Returns whether the touch is connected and functioning.
  196. **num_buttons** () : int
  197. Returns the number of buttons of the touch.
  198. **num_axes** () : int
  199. Returns the number of axes of the touch.
  200. **pressed** (id) : bool
  201. Returns whether the button *id* is pressed in the current frame.
  202. **released** (id) : bool
  203. Returns whether the button *id* is released in the current frame.
  204. **any_pressed** () : bool
  205. Returns the *id* of the first button that was pressed in the current frame
  206. or ``nil`` if no buttons were pressed at all.
  207. **any_released** () : bool
  208. Returns the *id* of the first button that was released in the current frame
  209. or ``nil`` if no buttons were released at all.
  210. **button** (id) : float
  211. Returns the value of the button *id* in the range [0..1].
  212. **axis** (id) : Vector3
  213. Returns the value of the axis *id*.
  214. **button_name** (id) : string
  215. Returns the name of the button *id*.
  216. **axis_name** (id) : string
  217. Returns the name of the axis *id*.
  218. **button_id** (name) : int
  219. Returns the *id* of the button *name* or ``nil`` if no matching button is found.
  220. **axis_id** (name) : int
  221. Returns the *id* of the axis *name* or ``nil`` if no matching axis is found.
  222. Pad1, Pad2, Pad3, Pad4
  223. ----------------------
  224. **name** () : string
  225. Returns the name of the pad.
  226. **connected** () : bool
  227. Returns whether the pad is connected and functioning.
  228. **num_buttons** () : int
  229. Returns the number of buttons of the pad.
  230. **num_axes** () : int
  231. Returns the number of axes of the pad.
  232. **pressed** (id) : bool
  233. Returns whether the button *id* is pressed in the current frame.
  234. **released** (id) : bool
  235. Returns whether the button *id* is released in the current frame.
  236. **any_pressed** () : bool
  237. Returns the *id* of the first button that was pressed in the current frame
  238. or ``nil`` if no buttons were pressed at all.
  239. **any_released** () : bool
  240. Returns the *id* of the first button that was released in the current frame
  241. or ``nil`` if no buttons were released at all.
  242. **button** (id) : float
  243. Returns the value of the button *id* in the range [0..1].
  244. **axis** (id) : Vector3
  245. Returns the value of the axis *id*.
  246. **button_name** (id) : string
  247. Returns the name of the button *id*.
  248. **axis_name** (id) : string
  249. Returns the name of the axis *id*.
  250. **button_id** (name) : int
  251. Returns the *id* of the button *name* or ``nil`` if no matching button is found.
  252. **axis_id** (name) : int
  253. Returns the *id* of the axis *name* or ``nil`` if no matching axis is found.
  254. **deadzone** (id) : deadzone_mode, deadzone_size
  255. Returns the deadzone mode and size for the axis *id*.
  256. **set_deadzone** (id, deadzone_mode, deadzone_size)
  257. Sets the *deadzone_mode* and *deadzone_size* for the axis *id*.
  258. Pad Button Names
  259. ~~~~~~~~~~~~~~~~
  260. * ``up``, ``down``, ``left``, ``right``
  261. * ``start``, ``back``, ``guide``
  262. * ``thumb_left``, ``thumb_right``
  263. * ``shoulder_left``, ``shoulder_right``
  264. * ``a``, ``b``, ``x``, ``y``
  265. Pad Axis Names
  266. ~~~~~~~~~~~~~~
  267. * ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1].
  268. * ``trigger_left``, ``trigger_right``: The z element represents the left or right trigger [0; +1].
  269. Material
  270. ========
  271. **set_float** (material, name, value)
  272. Sets the *value* of the variable *name*.
  273. **set_vector2** (material, name, value)
  274. Sets the *value* of the variable *name*.
  275. **set_vector3** (material, name, value)
  276. Sets the *value* of the variable *name*.
  277. **set_vector4** (material, name, value)
  278. Sets the *value* of the variable *name*.
  279. **set_matrix4x4** (material, name, value)
  280. Sets the *value* of the variable *name*.
  281. Math
  282. ====
  283. Vector3
  284. -------
  285. Constructors
  286. ~~~~~~~~~~~~
  287. **Vector3** (x, y, z) : Vector3
  288. Returns a new vector from individual elements.
  289. Functions
  290. ~~~~~~~~~
  291. **x** (v) : float
  292. Returns the x value of the vector.
  293. **y** (v) : float
  294. Returns the y value of the vector.
  295. **z** (v) : float
  296. Returns the z value of the vector.
  297. **.x** : float
  298. Returns/assigns the x value of the vector.
  299. **.y** : float
  300. Returns/assigns the y value of the vector.
  301. **.z** : float
  302. Returns/assigns the z value of the vector.
  303. **set_x** (v, x)
  304. Sets the value of the x value of the vector.
  305. **set_y** (v, y)
  306. Sets the value of the y value of the vector.
  307. **set_z** (v, z)
  308. Sets the value of the z value of the vector.
  309. **elements** (v) : float, float, float
  310. Returns the x, y and z elements of the vector.
  311. **add** (a, b) : Vector3
  312. Adds the vector *a* to *b* and returns the result.
  313. **subtract** (a, b) : Vector3
  314. Subtracts the vector *b* from *a* and returns the result.
  315. **multiply** (a, k) : Vector3
  316. Multiplies the vector *a* by the scalar *k* and returns the result.
  317. **dot** (a, b) : float
  318. Returns the dot product between the vectors *a* and *b*.
  319. **cross** (a, b) : Vector3
  320. Returns the cross product between the vectors *a* and *b*.
  321. **equal** (a, b) : bool
  322. Returns true whether the vectors *a* and *b* are equal.
  323. **length** (a) : float
  324. Returns the length of *a*.
  325. **length_squared** (a) : float
  326. Returns the squared length of *a*.
  327. **set_length** (a, len)
  328. Sets the length of *a* to *len*.
  329. **normalize** (a) : Vector3
  330. Normalizes *a* and returns the result.
  331. **distance** (a, b) : float
  332. Returns the distance between the points *a* and *b*.
  333. **distance_squared** (a, b) : float
  334. Returns the squared distance between the points *a* and *b*.
  335. **angle** (a, b) : float
  336. Returns the angle between the vectors *a* and *b*.
  337. **max** (a, b) : Vector3
  338. Returns a vector that contains the largest value for each element from *a* and *b*.
  339. **min** (a, b) : Vector3
  340. Returns a vector that contains the smallest value for each element from *a* and *b*.
  341. **lerp** (a, b, t) : Vector3
  342. Returns the linearly interpolated vector between *a* and *b* at time *t* in [0, 1].
  343. | **forward** () : Vector3
  344. | **backward** () : Vector3
  345. | **left** () : Vector3
  346. | **right** () : Vector3
  347. | **up** () : Vector3
  348. | **down** () : Vector3
  349. | Returns the corresponding semantic axis.
  350. **zero** () : Vector3
  351. Returns a vector with all values set to zero.
  352. **to_string** (v) : string
  353. Returns a string representing the vector *v*.
  354. Vector3Box
  355. ----------
  356. Constructors
  357. ~~~~~~~~~~~~
  358. **Vector3Box** () : Vector3Box
  359. Returns a new Vector3Box initialized with the zero vector.
  360. **Vector3Box** (v) : Vector3Box
  361. Returns a new Vector3Box from the Vector3 *v*.
  362. **Vector3Box** (x, y, z) : Vector3Box
  363. Returns a new Vector3Box from individual elements.
  364. Functions
  365. ~~~~~~~~~
  366. **store** (v)
  367. Stores the Vector3 *v* in the box.
  368. **store** (x, y, z)
  369. Stores Vector3(x, y, z) in the box.
  370. **unbox** () : Vector3
  371. Returns the stored vector from the box.
  372. Quaternion
  373. ----------
  374. Constructors
  375. ~~~~~~~~~~~~
  376. **Quaternion** (axis, angle) : Quaternion
  377. Returns a new quaternion from *axis* and *angle*.
  378. **from_elements** (x, y, z, w) : Quaternion
  379. Returns a new quaternion from individual elements.
  380. **from_axis_angle** (axis, angle) : Quaternion
  381. Returns a new quaternion from *axis* and *angle*.
  382. Functions
  383. ~~~~~~~~~
  384. **negate** (q) : Quaternion
  385. Negates the quaternion *q* and returns the result.
  386. **identity** () : Quaternion
  387. Returns the identity quaternion.
  388. **multiply** (a, b) : Quaternion
  389. Multiplies the quaternions *a* and *b*. (i.e. rotates first by *a* then by *b*).
  390. **multiply_by_scalar** (a, k) : Quaternion
  391. Multiplies the quaternion *a* by the scalar *k*.
  392. **dot** (a, b) : float
  393. Returns the dot product between quaternions *a* and *b*.
  394. **length** (q) : float
  395. Returns the length of *q*.
  396. **normalize** (q) : Quaternion
  397. Normalizes the quaternion *q* and returns the result.
  398. **conjugate** (q) : Quaternion
  399. Returns the conjugate of quaternion *q*.
  400. **inverse** (q) : Quaternion
  401. Returns the inverse of quaternion *q*.
  402. **power** (q, exp) : Quaternion
  403. Returns the quaternion *q* raised to the power of *exp*.
  404. **elements** (q) : float, float, float, float
  405. Returns the x, y, z and w elements of the quaternion.
  406. **look** (dir, [up]) : Quaternion
  407. Returns the quaternion describing the rotation needed to face towards *dir*.
  408. If *up* is not specified, Vector3.up() is used.
  409. **right** (q) : Vector3
  410. Returns the right axis of the rotation described by *q*.
  411. **up** (q) : Vector3
  412. Returns the up axis of the rotation described by *q*.
  413. **forward** (q) : Vector3
  414. Returns the forward axis of the rotation described by *q*.
  415. **lerp** (a, b, t) : Quaternion
  416. Returns the linearly interpolated quaternion between *a* and *b* at time *t* in [0, 1].
  417. It uses NLerp.
  418. **to_string** (q) : string
  419. Returns a string representing the quaternion *q*.
  420. QuaternionBox
  421. -------------
  422. Constructors
  423. ~~~~~~~~~~~~
  424. **QuaternionBox** () : QuaternionBox
  425. Returns a new QuaternionBox initialized with the identity quaternion.
  426. **QuaternionBox** (q) : QuaternionBox
  427. Returns a new QuaternionBox from the Quaternion *q*.
  428. **QuaternionBox** (x, y, z, w) : QuaternionBox
  429. Returns a new QuaternionBox from individual elements.
  430. Functions
  431. ~~~~~~~~~
  432. **store** (q)
  433. Stores the Quaternion *q* in the box.
  434. **store** (x, y, z, w)
  435. Stores Quaternion(x, y, z, w) in the box.
  436. **unbox** () : Quaternion
  437. Returns the stored quaternion from the box.
  438. Matrix4x4
  439. ---------
  440. Constructors
  441. ~~~~~~~~~~~~
  442. **Matrix4x4** (xx, xy, xz, xw, yx, yy, yz, yw, zx, zy, zz, zw, tx, ty, tz, tw) : Matrix4x4
  443. Returns a new matrix from individual elements.
  444. **from_quaternion** (q) : Matrix4x4
  445. Returns a new matrix from *q*.
  446. **from_translation** (t) : Matrix4x4
  447. Returns a new matrix from *t*.
  448. **from_quaternion_translation** (q, t) : Matrix4x4
  449. Returns a new matrix from *q* and *t*.
  450. **from_axes** (x, y, z, t) : Matrix4x4
  451. Returns a new matrix from *x*, *y*, *z* and *t*.
  452. Functions
  453. ~~~~~~~~~
  454. **copy** (m) : Matrix4x4
  455. Returns a copy of the matrix *m*.
  456. **add** (a, b) : Matrix4x4
  457. Adds the matrix *a* to *b* and returns the result.
  458. **subtract** (a, b) : Matrix4x4
  459. Subtracts the matrix *b* from *a* and returns the result.
  460. **multiply** (a, b) : Matrix4x4
  461. Multiplies the matrix *a* by *b* and returns the result. (i.e. transforms first by *a* then by *b*)
  462. **equal** (a, b) : bool
  463. Returns true whether the matrices *a* and *b* are equal.
  464. **transpose** (m) : Matrix4x4
  465. Transposes the matrix *m* and returns the result.
  466. **invert** (m) : Matrix4x4
  467. Inverts the matrix *m* and returns the result.
  468. **x** (m) : Vector3
  469. Returns the x axis of the matrix *m*.
  470. **y** (m) : Vector3
  471. Returns the y axis of the matrix *m*.
  472. **z** (m) : Vector3
  473. Returns the z axis of the matrix *m*.
  474. **set_x** (m, x)
  475. Sets the x axis of the matrix *m*.
  476. **set_y** (m, y)
  477. Sets the y axis of the matrix *m*.
  478. **set_z** (m, z)
  479. Sets the z axis of the matrix *m*.
  480. **rotation** (m) : Quaternion
  481. Returns the rotation portion of the matrix *m*.
  482. **set_rotation** (m, r)
  483. Sets the rotation portion of the matrix *m*.
  484. **translation** (m) : Vector3
  485. Returns the translation portion of the matrix *m*.
  486. **set_translation** (m, t)
  487. Sets the translation portion of the matrix *m*.
  488. **identity** ()
  489. Returns the identity matrix.
  490. **transform** (m, v) : Vector3
  491. Transforms the vector *v* by the matrix *m* and returns the result.
  492. **to_string** (m) : string
  493. Returns a string representing the matrix *m*.
  494. Matrix4x4Box
  495. ------------
  496. Constructors
  497. ~~~~~~~~~~~~
  498. **Matrix4x4Box** () : Matrix4x4Box
  499. Returns a new Matrix4x4Box initialized with the identity matrix.
  500. **Matrix4x4Box** (m) : Matrix4x4Box
  501. Returns a new Matrix4x4Box from the Matrix4x4 *m*.
  502. Functions
  503. ~~~~~~~~~
  504. **store** (m)
  505. Stores the Matrix4x4 *m* in the box.
  506. **unbox** () : Matrix4x4
  507. Returns the stored matrix from the box.
  508. Color4
  509. ------
  510. Constructors
  511. ~~~~~~~~~~~~
  512. **Color4** (r, g, b, a) : Color4
  513. Returns a new Color4 from individual elements.
  514. Functions
  515. ~~~~~~~~~
  516. **lerp** (a, b, t) : Color4
  517. Returns the linearly interpolated color between *a* and *b* at time *t* in [0, 1].
  518. | **black** () : Color4
  519. | **white** () : Color4
  520. | **red** () : Color4
  521. | **green** () : Color4
  522. | **blue** () : Color4
  523. | **yellow** () : Color4
  524. | **orange** () : Color4
  525. | Returns the corresponding mnemonic color.
  526. **to_string** (c) : string
  527. Returns a string representing the color *c*.
  528. Math
  529. ----
  530. **ray_plane_intersection** (from, dir, point, normal) : float
  531. Returns the distance along ray (from, dir) to intersection point with plane defined by
  532. *point* and *normal* or -1.0 if no intersection.
  533. **ray_disc_intersection** (from, dir, center, radius, normal) : float
  534. Returns the distance along ray (from, dir) to intersection point with disc defined by
  535. *center*, *radius* and *normal* or -1.0 if no intersection.
  536. **ray_sphere_intersection** (from, dir, center, radius) : float
  537. Returns the distance along ray (from, dir) to intersection point with sphere defined by
  538. *center* and *radius* or -1.0 if no intersection.
  539. **ray_obb_intersection** (from, dir, tm, half_extents) : float
  540. Returns the distance along ray (from, dir) to intersection point with the oriented
  541. bounding box (tm, half_extents) or -1.0 if no intersection.
  542. **ray_triangle_intersection** (from, dir, v0, v1, v2) : float
  543. Returns the distance along ray (from, dir) to intersection point with the triangle
  544. (v0, v1, v2) or -1.0 if no intersection.
  545. **obb_intersects_frustum** (obb_tm, obb_half_extents, n0, d0, n1, d1, n2, d2, n3, d3, n4, d4, n4, d5) : bool
  546. Returns whether the oriented bounding box (obb_tm, obb_half_extents) intersects
  547. the frustum defined by the planes ((n0, d0), (n1, d1), ..., (n5, d5)). The
  548. planes be given in BRTLNF order, where B = bottom plane, R = right plane etc.
  549. PhysicsWorld
  550. =============
  551. **gravity** (pw) : Vector3
  552. Returns the gravity.
  553. **set_gravity** (pw, gravity)
  554. Sets the gravity.
  555. **cast_ray** (pw, from, dir, length) : hit, collision_pos, normal, time, UnitId, Actor
  556. Casts a ray into the physics world and returns the closest actor it intersects with.
  557. If *hit* is true the following return values contain the *collision_pos* in
  558. world space, the *normal* of the surface that was hit, the time of impact
  559. in [0..1] and the *unit* and the *actor* that was hit.
  560. **cast_ray_all** (pw, from, dir, length) : table
  561. Casts a ray into the physics world and returns all the
  562. actors it intersects with as an array of `RaycastHit`_ tables.
  563. **cast_sphere** (pw, from, radius, dir, length) : hit, collision_pos, normal, time, UnitId, Actor
  564. Casts a sphere into the physics world and returns the closest actor it intersects with.
  565. If *hit* is true the following return values contain the *collision_pos* in
  566. world space, the *normal* of the surface that was hit, the time of impact
  567. in [0..1] and the *unit* and the *actor* that was hit.
  568. **cast_box** (pw, from, half_extents, dir, length) : hit, collision_pos, normal, time, UnitId, Actor
  569. Casts a box into the physics world and returns the closest actor it intersects with.
  570. If *hit* is true the following return values contain the *collision_pos* in
  571. world space, the *normal* of the surface that was hit, the time of impact
  572. in [0..1] and the *unit* and the *actor* that was hit.
  573. **enable_debug_drawing** (pw, enable)
  574. Sets whether to *enable* debug drawing.
  575. RaycastHit
  576. ----------
  577. RaycastHit is a lua table with 5 fields:
  578. * ``[1]``: The collision position in world space.
  579. * ``[2]``: The normal of the surface that was hit.
  580. * ``[3]``: The time of impact in [0..1].
  581. * ``[4]``: The unit that was hit.
  582. * ``[5]``: The actor that was hit.
  583. Actor
  584. -----
  585. **actor_destroy** (pw, actor)
  586. Destroys the *actor* instance.
  587. **actor_instance** (pw, unit) : Id
  588. Returns the ID of the actor owned by the *unit*, or ``nil``.
  589. **actor_world_position** (pw, actor) : Vector3
  590. Returns the world position of the *actor*.
  591. **actor_world_rotation** (pw, actor) : Quaternion
  592. Returns the world rotation of the *actor*.
  593. **actor_world_pose** (pw, actor) : Matrix4x4
  594. Returns the world pose of the *actor*.
  595. **actor_teleport_world_position** (pw, actor, position)
  596. Teleports the *actor* to the given world *position*.
  597. **actor_teleport_world_rotation** (pw, actor, rotation)
  598. Teleports the *actor* to the given world *rotation*.
  599. **actor_teleport_world_pose** (pw, actor, pose)
  600. Teleports the *actor* to the given world *pose*.
  601. **actor_center_of_mass** (pw, actor) : Vector3
  602. Returns the center of mass of the *actor*.
  603. **actor_enable_gravity** (pw, actor)
  604. Enables gravity for the *actor*.
  605. **actor_disable_gravity** (pw, actor)
  606. Disables gravity for the *actor*.
  607. **actor_enable_collision** (pw, actor)
  608. Enables collision detection for the *actor*.
  609. **actor_disable_collision** (pw, actor)
  610. Disables collision detection for the *actor*.
  611. **actor_set_collision_filter** (pw, actor, name)
  612. Sets the collision filter of the *actor*.
  613. **actor_set_kinematic** (pw, actor, kinematic)
  614. Sets whether the *actor* is *kinematic* or not.
  615. .. note::
  616. This call has no effect on static actors.
  617. **actor_is_static** (pw, actor) : bool
  618. Returns whether the *actor* is static.
  619. **actor_is_dynamic** (pw, actor) bool
  620. Returns whether the *actor* is dynamic.
  621. **actor_is_kinematic** (pw, actor) : bool
  622. Returns whether the *actor* is kinematic (keyframed).
  623. **actor_is_nonkinematic** (pw, actor) : bool
  624. Returns whether the *actor* is nonkinematic (i.e. dynamic and not kinematic).
  625. **actor_linear_damping** (pw, actor) : float
  626. Returns the linear damping of the *actor*.
  627. **actor_set_linear_damping** (pw, actor, damping)
  628. Sets the linear *damping* of the *actor*.
  629. **actor_angular_damping** (pw, actor) : float
  630. Returns the angular damping rate of the *actor*.
  631. **actor_set_angular_damping** (pw, actor, rate)
  632. Sets the angular damping *rate* of the *actor*.
  633. **actor_linear_velocity** (pw, actor) : Vector3
  634. Returns the linear velocity of the *actor*.
  635. **actor_set_linear_velocity** (pw, actor, velocity)
  636. Sets the linear *velocity* of the *actor*.
  637. .. note::
  638. This call only affects nonkinematic actors.
  639. **actor_angular_velocity** (pw, actor) : Vector3
  640. Returns the angular velocity of the *actor*.
  641. **actor_set_angular_velocity** (pw, actor, velocity)
  642. Sets the angular *velocity* of the *actor*.
  643. .. note::
  644. This call only affects nonkinematic actors.
  645. **actor_add_impulse** (pw, actor, impulse)
  646. Adds a linear *impulse* (acting along the center of mass) to the *actor*.
  647. .. note::
  648. This call only affects nonkinematic actors.
  649. **actor_add_impulse_at** (pw, actor, impulse, position)
  650. Adds a linear *impulse* (acting along the world position *pos*) to the *actor*.
  651. .. note::
  652. This call only affects nonkinematic actors.
  653. **actor_add_torque_impulse** (pw, actor, impulse)
  654. Adds a torque *impulse* to the *actor*.
  655. **actor_push** (pw, actor, velocity, mass)
  656. Pushes the *actor* as if it was hit by a point object with the given *mass*
  657. travelling at the given *velocity*.
  658. .. note::
  659. This call only affects nonkinematic actors.
  660. **actor_push_at** (pw, actor, velocity, mass, position)
  661. Like push() but applies the force at the world *position*.
  662. .. note::
  663. This call only affects nonkinematic actors.
  664. **actor_is_sleeping** (pw, actor) : bool
  665. Returns whether the *actor* is sleeping.
  666. **actor_wake_up** (pw, actor)
  667. Wakes the *actor* up.
  668. Profiler
  669. ========
  670. **enter_scope** (name)
  671. Starts a new profile scope with the given *name*.
  672. **leave_scope** ()
  673. Ends the last profile scope.
  674. **record** (name, value)
  675. Records *value* with the given *name*. Value can be either number or Vector3.
  676. RenderWorld
  677. ===========
  678. **enable_debug_drawing** (rw, enable)
  679. Sets whether to *enable* debug drawing.
  680. Mesh
  681. ----
  682. **mesh_create** (rw, unit, mesh_resource, geometry_name, material_resource, visible, pose) : Id
  683. Creates a new mesh instance for *unit* and returns its id.
  684. **mesh_destroy** (rw, mesh)
  685. Destroys the *mesh* instance.
  686. **mesh_instance** (rw, unit) : Id
  687. Returns the ID of the mesh owned by the *unit*, or ``nil``.
  688. **mesh_material** (rw, mesh) : Material
  689. Returns the material of the *mesh*.
  690. **mesh_set_material** (rw, mesh, material)
  691. Sets the *material* of the *mesh*.
  692. **mesh_set_visible** (rw, mesh, visible)
  693. Sets whether the *mesh* is *visible*.
  694. **mesh_obb** (rw, mesh) : Matrix4x4, Vector3
  695. Returns the Oriented-Bounding-Box of the *mesh* as (pose, half_extents).
  696. **mesh_cast_ray** (rw, mesh, from, dir) : float
  697. Returns the distance along ray (from, dir) to intersection point with the *mesh* or -1.0 if no intersection.
  698. Sprite
  699. ------
  700. **sprite_create** (rw, unit, sprite_resource, material_resource, visible, pose) : Id
  701. Creates a new sprite instance for the *unit* and returns its id.
  702. **sprite_destroy** (rw, sprite)
  703. Destroys the *sprite* instance.
  704. **sprite_instance** (rw, unit) : Id
  705. Returns the ID of the sprite owned by the *unit*, or ``nil``.
  706. **sprite_material** (rw, sprite) : Material
  707. Returns the material of the *sprite*.
  708. **sprite_set_material** (rw, sprite, material)
  709. Sets the *material* of the *sprite*.
  710. **sprite_set_frame** (rw, sprite, index)
  711. Sets the frame *index* of the *sprite*.
  712. The *index* automatically wraps if it greater than the total number of
  713. frames in the sprite.
  714. **sprite_set_visible** (rw, sprite, visible)
  715. Sets whether the *sprite* is *visible*.
  716. **sprite_flip_x** (rw, sprite, flip)
  717. Sets whether to flip the *sprite* on the x-axis.
  718. **sprite_flip_y** (rw, sprite, flip)
  719. Sets whether to flip the *sprite* on the y-axis.
  720. **sprite_set_layer** (rw, sprite, layer)
  721. Sets the rendering *layer* of the *sprite*.
  722. **sprite_set_depth** (rw, sprite, depth)
  723. Sets the rendering *depth* of the *sprite*.
  724. **sprite_obb** (rw, sprite) : Matrix4x4, Vector3
  725. Returns the Oriented-Bounding-Box of the *sprite* as (pose, half_extents).
  726. **sprite_cast_ray** (rw, sprite, from, dir) : float, int, int
  727. Returns (t, layer, depth), where *t* is the distance along ray (from, dir) to
  728. intersection point with the *sprite* or -1.0 if no intersection.
  729. Light
  730. -----
  731. **light_create** (rw, unit, type, range, intensity, spot_angle, color, pose) : Id
  732. Creates a new light for the *unit* and returns its id.
  733. Type can be either ``directional``, ``omni`` or ``spot``.
  734. **light_destroy** (rw, light)
  735. Destroys the *light* instance.
  736. **light_instance** (rw, unit) : Id
  737. Returns the ID of the light owned by the *unit*, or ``nil``.
  738. **light_type** (rw, light) : string
  739. Returns the type of the *light*.
  740. It can be either ``directional``, ``omni`` or ``spot``.
  741. **light_color** (rw, light) : Color4
  742. Returns the color of the *light*.
  743. **light_range** (rw, light) : float
  744. Returns the range of the *light*.
  745. **light_intensity** (rw, light) : float
  746. Returns the intensity of the *light*.
  747. **light_spot_angle** (rw, light) : float
  748. Returns the spot angle of the *light*.
  749. **light_set_type** (rw, light, type)
  750. Sets the *type* of the *light*.
  751. **light_set_color** (rw, light, color)
  752. Sets the *color* of the *light*.
  753. **light_set_range** (rw, light, range)
  754. Sets the *range* of the *light*.
  755. **light_set_intensity** (rw, light, intensity)
  756. Sets the *intensity* of the *light*.
  757. **light_set_spot_angle** (rw, light, angle)
  758. Sets the spot *angle* of the *light*.
  759. **light_debug_draw** (rw, light, debug_line)
  760. Fills *debug_line* with debug lines from the *light*.
  761. ResourcePackage
  762. ===============
  763. **load** (package)
  764. Loads all the resources in the *package*.
  765. .. note::
  766. The resources are not immediately available after the call is made,
  767. instead, you have to poll for completion with has_loaded().
  768. **unload** (package)
  769. Unloads all the resources in the *package*.
  770. **flush** (package)
  771. Waits until the *package* has been loaded.
  772. **has_loaded** (package) : bool
  773. Returns whether the *package* has been loaded.
  774. SceneGraph
  775. ==========
  776. **create** (sg, unit, position, rotation, scale) : Id
  777. Creates the transform for the *unit* and returns its ID.
  778. **destroy** (sg, transform)
  779. Destroys the *transform* instance.
  780. **instance** (sg, unit) : Id
  781. Returns the ID of the transform owned by the *unit*, or ``nil``.
  782. **local_position** (sg, transform) : Vector3
  783. Returns the local position of the *transform*.
  784. **local_rotation** (sg, transform) : Quaternion
  785. Returns the local rotation of the *transform*.
  786. **local_scale** (sg, transform) : Vector3
  787. Returns the local scale of the *transform*.
  788. **local_pose** (sg, transform) : Matrix4x4
  789. Returns the local pose of the *transform*.
  790. **world_position** (sg, transform) : Vector3
  791. Returns the world position of the *transform*.
  792. **world_rotation** (sg, transform) : Quaternion
  793. Returns the world rotation of the *transform*.
  794. **world_pose** (sg, transform) : Matrix4x4
  795. Returns the world pose of the *transform*.
  796. **set_local_position** (sg, transform, position)
  797. Sets the local *position* of the *transform*.
  798. **set_local_rotation** (sg, transform, rotation)
  799. Sets the local *rotation* of the *transform*.
  800. **set_local_scale** (sg, transform, scale)
  801. Sets the local *scale* of the *transform*.
  802. **set_local_pose** (sg, transform, pose)
  803. Sets the local *pose* of the *transform*.
  804. **link** (sg, parent, child, child_local_position, child_local_rotation, child_local_scale)
  805. Links `child` to `parent`. After linking the child will follow its
  806. parent. Set child_local_* to modify the child position after it has been
  807. linked to the parent, otherwise che child will be positioned at the
  808. location of its parent.
  809. **unlink** (sg, child)
  810. Unlinks `child` from its parent if it has any. After unlinking, the local
  811. pose of the @a child is set to its previous world pose.
  812. SoundWorld
  813. ===========
  814. **stop_all** (sound_world)
  815. Stops all the sounds in the world.
  816. **pause_all** (sound_world)
  817. Pauses all the sounds in the world
  818. **resume_all** (sound_world)
  819. Resumes all previously paused sounds in the world.
  820. **is_playing** (sound_world, id) : bool
  821. Returns whether the sound *id* is playing.
  822. UnitManager
  823. ===========
  824. **create** ([world]) : UnitId
  825. Creates a new empty unit. If *world* is specified, the unit will be owned by
  826. that world.
  827. **destroy** (unit)
  828. Destroys the given *unit*.
  829. **alive** (unit) : bool
  830. Returns whether the unit is alive.
  831. Window
  832. ======
  833. **show** ()
  834. Shows the window.
  835. **hide** ()
  836. Hides the window.
  837. **resize** (width, height)
  838. Resizes the window to *width* and *height*.
  839. **move** (x, y)
  840. Moves the window to *x* and *y*.
  841. **minimize** ()
  842. Minimizes the window.
  843. **maximize** ()
  844. Maximizes the window.
  845. **restore** ()
  846. Restores the window.
  847. **title** () : string
  848. Returns the title of the window.
  849. **set_title** (title)
  850. Sets the title of the window.
  851. **show_cursor** (show)
  852. Sets whether to *show* the cursor.
  853. **set_fullscreen** (fullscreen)
  854. Sets whether the window is *fullscreen*.
  855. **set_cursor** (cursor)
  856. Sets the mouse *cursor* on this window. Cursor can be any of ``arrow``, ``hand``,
  857. ``text_input``, ``corner_top_left``, ``corner_top_right``, ``corner_bottom_left``,
  858. ``corner_bottom_right``, ``size_horizontal``, ``size_vertical`` or ``wait``.
  859. **set_cursor_mode** (cursor, mode)
  860. Sets the mouse cursor *mode* on this window. Mode can be either ``normal`` or ``disabled``.
  861. Setting the mode to ``disabled`` hides the cursor and automatically re-centers it every time it
  862. is moved.
  863. World
  864. =====
  865. **spawn_unit** (world, name, [position, rotation, scale]) : UnitId
  866. Spawns a new instance of the unit *name* at the given *position*, *rotation* and *scale*.
  867. **spawn_empty_unit** (world) : UnitId
  868. Spawns a new empty unit and returns its id.
  869. **destroy_unit** (world, unit)
  870. Destroys the given *unit*.
  871. **num_units** (world) : int
  872. Returns the number of units in the *world*.
  873. **units** (world) : table
  874. Returns all the the units in the world in a table.
  875. **unit_by_name** (world, name) : UnitId
  876. Returns the unit with the given Level Editor *name* or ``nil`` if no such unit is found.
  877. If there are multiple units with the same name, a random one will be returned.
  878. **update_animations** (world, dt)
  879. Update all animations with *dt*.
  880. **update_scene** (world, dt)
  881. Updates the scene with *dt*.
  882. **update** (world, dt)
  883. Updates the world with *dt*.
  884. **create_debug_line** (world, depth_test) : DebugLine
  885. Creates a new DebugLine. *depth_test* controls whether to
  886. enable depth test when rendering the lines.
  887. **destroy_debug_line** (world, line)
  888. Destroys the debug *line*.
  889. **create_screen_gui** (world) : Gui
  890. Creates a new Gui.
  891. **scene_graph** (world) : SceneGraph
  892. Returns the scene graph.
  893. **render_world** (world) : RenderWorld
  894. Returns the render sub-world.
  895. **physics_world** (world) : PhysicsWorld
  896. Returns the physics sub-world.
  897. **sound_world** (world) : SoundWorld
  898. Returns the sound sub-world.
  899. **animation_state_machine** (world) : AnimationStateMachine
  900. Returns the animation state machine.
  901. Camera
  902. ------
  903. **camera_create** (world, unit, projection, fov, far_range, near_range, pose) : Id
  904. Creates a new camera for *unit* and returns its id.
  905. Projection can be either ``orthographic`` or ``perspective``.
  906. **camera_destroy** (world, camera)
  907. Destroys the *camera* instance.
  908. **camera_instance** (world, unit) : Id
  909. Returns the ID of the camera owned by the *unit*, or ``nil``.
  910. **camera_set_projection_type** (world, camera, projection)
  911. Sets the projection type of the *camera*.
  912. Projection can be either ``orthographic`` or ``perspective``.
  913. **camera_projection_type** (world, camera) : string
  914. Returns the projection type of the *camera*.
  915. It can be either ``orthographic`` or ``perspective``.
  916. **camera_fov** (world, camera) : float
  917. Returns the field-of-view of the *camera* in degrees.
  918. **camera_set_fov** (world, camera, fov)
  919. Sets the field-of-view of the *camera* in degrees.
  920. **camera_near_clip_distance** (world, camera) : float
  921. Returns the near clip distance of the *camera*.
  922. **camera_set_near_clip_distance** (world, camera, near)
  923. Sets the near clip distance of the *camera*.
  924. **camera_far_clip_distance** (world, camera) : float
  925. Returns the far clip distance of the *camera*.
  926. **camera_set_far_clip_distance** (world, camera, far)
  927. Sets the far clip distance of the *camera*.
  928. **camera_set_orthographic_size** (world, camera, half_size)
  929. Sets the vertical *half_size* of the orthographic view volume.
  930. The horizontal size is proportional to the viewport's aspect ratio.
  931. **camera_screen_to_world** (world, camera, pos) : Vector3
  932. Returns *pos* from screen-space to world-space coordinates.
  933. **camera_world_to_screen** (world, camera, pos) : Vector3
  934. Returns *pos* from world-space to screen-space coordinates.
  935. Sound
  936. -----
  937. **play_sound** (world, name, [loop, volume, position, range]) : SoundInstanceId
  938. Plays the sound with the given *name* at the given *position*, with the given
  939. *volume* and *range*. *loop* controls whether the sound must loop or not.
  940. **stop_sound** (world, id)
  941. Stops the sound with the given *id*.
  942. **link_sound** (world, id, unit, node)
  943. Links the sound *id* to the *node* of the given *unit*.
  944. After this call, the sound *id* will follow the unit *unit*.
  945. **set_listener_pose** (world, pose)
  946. Sets the *pose* of the listener.
  947. **set_sound_position** (world, id, position)
  948. Sets the *position* of the sound *id*.
  949. **set_sound_range** (world, id, range)
  950. Sets the *range* of the sound *id*.
  951. **set_sound_volume** (world, id, volume)
  952. Sets the *volume* of the sound *id*.
  953. Level
  954. -----
  955. **load_level** (world, name, [pos, rot]) : Level
  956. Loads the level *name* into the world at the given *position* and *rotation*.