Created wiki page through web user interface.
authorhenrik.rostedt@gmail.com
Fri, 21 Jan 2011 23:51:56 +0000
changeset 84 6fa418422e57
parent 83 b9fe713d7c27
child 85 9f1d2d3db844
Created wiki page through web user interface.
LuaLibraries.wiki
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LuaLibraries.wiki	Fri Jan 21 23:51:56 2011 +0000
@@ -0,0 +1,20 @@
+#summary Libraries for writing Lua scripts in Hedgewars.
+
+= Introduction =
+
+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 lang="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.
+
+= Locale =
+
+This library allows you to translate string and should be used whenever a script has text. It loads the appropriate locale file and check automatically.
+
+== lang(text) ==
+<blockquote>
+Returns the localised string of text or if it is not found it returns text.
+</blockquote>
\ No newline at end of file