LuaLibraries.wiki
changeset 501 04b4b463bf33
parent 500 dc66ea78b36d
child 525 b051cfd45c23
--- a/LuaLibraries.wiki	Mon Dec 15 15:27:32 2014 +0000
+++ b/LuaLibraries.wiki	Mon Dec 15 15:32:05 2014 +0000
@@ -5,11 +5,12 @@
 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.
 
 To use a library you only need to add one row at the top of the script:
-<code language="lua">
-loadfile(GetDataPath() .. "Scripts/<Library Name>.lua")()
-</code>
-Where <Library Name> is replaced by the name. Do not forget the "()" at the end as this initialises the file.
+<code language="lua">HedgewarsScriptLoad("Scripts/<Library Name>.lua")</code>
+Where `<Library Name>` is replaced by the name.
 
+*Note*: In old scripts, you will find this line instead:
+<code language="lua">loadfile(GetDataPath() .. "Scripts/<Library Name>.lua")()</code>
+This does not work with new Hedgewars versions anymore and causes the script to break. You have to replace it with `HedgewarsScriptLoad`.
 
 = Locale =