LuaLibraries.wiki
author sheepluva
Thu, 23 Mar 2023 20:47:32 +0000
changeset 2221 4bf8172a73a1
parent 1808 dc1bfd3a62ac
permissions -rw-r--r--
TableOfContents: TableOfContents: Adjust two Entries
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1329
bd781e19a52d Split Lua libraries into several sub-pages
Wuzzy <almikes@aol.com>
parents: 1234
diff changeset
     1
#summary Overview of libraries for writing Lua scripts in Hedgewars
84
6fa418422e57 Created wiki page through web user interface.
henrik.rostedt@gmail.com
parents:
diff changeset
     2
1808
dc1bfd3a62ac LuaLibraries: Shorten title
Wuzzy
parents: 1802
diff changeset
     3
= Lua libraries =
742
1ece82f7b547 LuaLibraries: Add title
Wuzzy
parents: 684
diff changeset
     4
1ece82f7b547 LuaLibraries: Add title
Wuzzy
parents: 684
diff changeset
     5
== Introduction ==
1329
bd781e19a52d Split Lua libraries into several sub-pages
Wuzzy <almikes@aol.com>
parents: 1234
diff changeset
     6
Libraries in scripts in Hedgewars are Lua files that are used by many scripts to add a common function, as an example the `Locale` library that allows scripts to translate text. The variables in these files are not exposed to the script using it but all the functions can be called.
84
6fa418422e57 Created wiki page through web user interface.
henrik.rostedt@gmail.com
parents:
diff changeset
     7
1352
e504c2e2246d LuaLibraries: headers
Wuzzy
parents: 1330
diff changeset
     8
== Usage ==
e504c2e2246d LuaLibraries: headers
Wuzzy
parents: 1330
diff changeset
     9
To use a library you only need to add this function call at the top of the script:
501
04b4b463bf33 Add HedgewarsScriptLoad, warn about the old and rusty loadfile function.
almikes@aol.com
parents: 500
diff changeset
    10
<code language="lua">HedgewarsScriptLoad("Scripts/<Library Name>.lua")</code>
04b4b463bf33 Add HedgewarsScriptLoad, warn about the old and rusty loadfile function.
almikes@aol.com
parents: 500
diff changeset
    11
Where `<Library Name>` is replaced by the name.
84
6fa418422e57 Created wiki page through web user interface.
henrik.rostedt@gmail.com
parents:
diff changeset
    12
1329
bd781e19a52d Split Lua libraries into several sub-pages
Wuzzy <almikes@aol.com>
parents: 1234
diff changeset
    13
== List of Lua libraries ==
246
7b1a6c46c3b5 Edited wiki page LuaLibraries through web user interface.
szabibibi@gmail.com
parents: 103
diff changeset
    14
1330
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    15
 * [LuaLibraryLocale Locale]
1379
d3e693b12cb6 LuaLibraries: Sort by importance
Wuzzy
parents: 1353
diff changeset
    16
 * [LuaLibraryParams Params]
1330
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    17
 * [LuaLibraryTracker Tracker]
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    18
 * [LuaLibraryAnimate Animate]
1379
d3e693b12cb6 LuaLibraries: Sort by importance
Wuzzy
parents: 1353
diff changeset
    19
 * [LuaLibraryUtils Utils]
1330
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    20
 * [LuaLibraryTargetPractice TargetPractice]
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    21
 * [LuaLibrarySpeedShoppa SpeedShoppa]
d92ed3272533 LuaLibraries: fix indent
Wuzzy
parents: 1329
diff changeset
    22
 * [LuaLibrarySimpleMission SimpleMission]
1484
278848d942ba Add Achievements lib
Wuzzy <almikes@aol.com>
parents: 1379
diff changeset
    23
 * [LuaLibraryAchievements Achievements]
1738
b39890f90341 LuaLibraries: add newline at end
Wuzzy
parents: 1484
diff changeset
    24