<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://fcitx-im.org/index.php?action=history&amp;feed=atom&amp;title=Lua</id>
	<title>Lua - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://fcitx-im.org/index.php?action=history&amp;feed=atom&amp;title=Lua"/>
	<link rel="alternate" type="text/html" href="https://fcitx-im.org/index.php?title=Lua&amp;action=history"/>
	<updated>2026-05-03T12:28:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://fcitx-im.org/index.php?title=Lua&amp;diff=46086&amp;oldid=prev</id>
		<title>Weng Xuetian: Created page with &quot;Fcitx can be easily extended with lua.  API documentation is available on [https://fcitx.github.io/fcitx5-lua/ Github].  = Make Fcitx load lua script =  == Single file lua scr...&quot;</title>
		<link rel="alternate" type="text/html" href="https://fcitx-im.org/index.php?title=Lua&amp;diff=46086&amp;oldid=prev"/>
		<updated>2024-03-21T00:23:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Fcitx can be easily extended with lua.  API documentation is available on [https://fcitx.github.io/fcitx5-lua/ Github].  = Make Fcitx load lua script =  == Single file lua scr...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Fcitx can be easily extended with lua.&lt;br /&gt;
&lt;br /&gt;
API documentation is available on [https://fcitx.github.io/fcitx5-lua/ Github].&lt;br /&gt;
&lt;br /&gt;
= Make Fcitx load lua script =&lt;br /&gt;
&lt;br /&gt;
== Single file lua script with imeapi support ==&lt;br /&gt;
Sometimes, you may have a simple lua script that you want to use. If that&amp;#039;s the case, you can simple put it under &amp;lt;code&amp;gt;~/.local/share/fcitx5/lua/imeapi/extensions/[name].lua&amp;lt;/code&amp;gt;. IME API will just load it upon start up.&lt;br /&gt;
&lt;br /&gt;
In addition to the standard fcitx module, there is also &amp;quot;ime&amp;quot; module available if you load it this way. The API follows the Google Pinyin&amp;#039;s lua API that was once available on Windows. If you have some scripts that was designed at that time, you may simple drop the script in without modification.&lt;br /&gt;
&lt;br /&gt;
== Stand alone lua addon ==&lt;br /&gt;
You may also create an standard lua addon like any other Fcitx addon. You will still need a file under &amp;lt;code&amp;gt;XDG_DATA/fcitx5/addon/[addon name].conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[Addon]&lt;br /&gt;
Name[da]=Lua IME-API&lt;br /&gt;
Name[fr]=API IME Lua&lt;br /&gt;
Name[ja]=Lua IME API&lt;br /&gt;
Name[ko]=Lua IME API&lt;br /&gt;
Name[ru]=Lua IME API&lt;br /&gt;
Name[zh_CN]=Lua IME API&lt;br /&gt;
Name[zh_TW]=Lua 輸入法 API&lt;br /&gt;
Name=Lua IME API&lt;br /&gt;
Comment[da]=Understøttelse af Lua IME-API&lt;br /&gt;
Comment[fr]=Prise en charge de l&amp;#039;API IME Lua&lt;br /&gt;
Comment[ja]=Lua IME API サポート&lt;br /&gt;
Comment[ko]=Lua IME API 지원&lt;br /&gt;
Comment[ru]=Поддержка Lua IME API&lt;br /&gt;
Comment[zh_CN]=Lua IME API 支持&lt;br /&gt;
Comment[zh_TW]=Lua 輸入法 API 支援&lt;br /&gt;
Comment=Lua IME API support&lt;br /&gt;
Category=Module&lt;br /&gt;
Version=5.0.12&lt;br /&gt;
Type=Lua&lt;br /&gt;
OnDemand=False&lt;br /&gt;
Configurable=False&lt;br /&gt;
Library=imeapi.lua&lt;br /&gt;
&lt;br /&gt;
[Addon/Dependencies]&lt;br /&gt;
0=luaaddonloader&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, only &amp;lt;code&amp;gt;Category=Module&amp;lt;/code&amp;gt; is supported. And unlike the regular shared library addon, the &amp;lt;code&amp;gt;Library&amp;lt;/code&amp;gt; field should be the entry file, which is placed under &amp;lt;code&amp;gt;XDG_DATA/fcitx5/lua/[addon name]/[file name].lua&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
And the addon dependency is required to contain &amp;lt;code&amp;gt;luaaddonloader&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Use Fcitx Lua API =&lt;br /&gt;
&lt;br /&gt;
Simply use &amp;lt;code&amp;gt;require(&amp;quot;fcitx&amp;quot;)&amp;lt;/code&amp;gt; to load fcitx module.&lt;br /&gt;
&lt;br /&gt;
There are many API that allows you to register a callback function. In most case, the callback function needs to be global and is passed with function name as string, not as a function variable.&lt;/div&gt;</summary>
		<author><name>Weng Xuetian</name></author>
	</entry>
</feed>