LuaAPI.wiki
changeset 1304 41f5508fe01c
parent 1303 3a0bedfe5c75
child 1325 14223a7d3c15
equal deleted inserted replaced
1303:3a0bedfe5c75 1304:41f5508fe01c
     4 = Core Lua API documentation =
     4 = Core Lua API documentation =
     5 
     5 
     6 == Introduction ==
     6 == Introduction ==
     7 
     7 
     8 Version 0.9.13 of Hedgewars introduced the ability to use Lua scripts to modify Hedgewars behaviour for different maps without having to recompile the whole game. The till then used triggers (only appeared in training maps) were removed.
     8 Version 0.9.13 of Hedgewars introduced the ability to use Lua scripts to modify Hedgewars behaviour for different maps without having to recompile the whole game. The till then used triggers (only appeared in training maps) were removed.
     9 
     9 f
    10 Lua is an easy to learn scripting language that’s implemented using open source libraries. If you’d like to learn more about Lua, have a look at [http://www.lua.org Lua's official homepage]. Even though its easy to learn syntax this wiki page won't explain all basics of using Lua, e.g. declaring variables or using control structures. There are tons of step-by-step tutorials and documentation available on the internet. Just throw “Lua” into your favourite search engine and give it a try.
    10 Lua is an easy to learn scripting language that’s implemented using open source libraries. If you’d like to learn more about Lua, have a look at [http://www.lua.org Lua's official homepage]. Even though its easy to learn syntax this wiki page won't explain all basics of using Lua, e.g. declaring variables or using control structures. There are tons of step-by-step tutorials and documentation available on the internet. Just throw “Lua” into your favourite search engine and give it a try.
    11 
    11 
    12 === About this wiki page ===
    12 === About this wiki page ===
    13 This page might become outdated. For a list of undocumented functions, see [http://hw.ercatec.net/docs/lua_wiki_check.php].
    13 This page might become outdated. For a list of undocumented functions, see [http://hw.ercatec.net/docs/lua_wiki_check.php].
    14 
    14 
   798 -- Collide with hedgehogs and objects</code>
   798 -- Collide with hedgehogs and objects</code>
   799 
   799 
   800 <code language="lua">SetGearCollisionMask(gear, 0x0000)
   800 <code language="lua">SetGearCollisionMask(gear, 0x0000)
   801 -- Collide with nothing</code>
   801 -- Collide with nothing</code>
   802 
   802 
   803 There are actual more flags availbable, but they are not as useful for use in Lua. You can find the full range of flags in the engine source code (in Pascal):
   803 There are actual more flags availbable, but they are not as useful for use in Lua and their constants have not been exposed to Lua. You can find the full range of flags in the engine source code (in Pascal):
   804 https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112
   804 
       
   805 [https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112]
   805 
   806 
   806 === <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
   807 === <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
   807 Gives the specified gear the velocity of `dx`, `dy`.
   808 Gives the specified gear the velocity of `dx`, `dy`.
   808 
   809 
   809 === <tt>!SetFlightTime(gearUid, flighttime)</tt> ===
   810 === <tt>!SetFlightTime(gearUid, flighttime)</tt> ===