# HG changeset patch # User henrik.rostedt@gmail.com # Date 1295653916 0 # Node ID 6fa418422e57bf79b5b85ceedc160749c74c5e01 # Parent b9fe713d7c2783d228c469b1350a229a01200ced Created wiki page through web user interface. diff -r b9fe713d7c27 -r 6fa418422e57 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: + +loadfile(GetDataPath() .. "Scripts/.lua")() + +Where 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) == +
+Returns the localised string of text or if it is not found it returns text. +
\ No newline at end of file