doc: add PHP plugin in scripting guide
parent
997768c4cf
commit
8e41d3b616
|
@ -29,13 +29,14 @@ schlanker Chat-Client der für verschiedene Betriebssysteme entwickelt wird.
|
|||
Dieses Handbuch beschreibt wie man Skripten für WeeChat schreiben kann. Dabei
|
||||
werden folgende Programmiersprachen unterstützt:
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
Fast alle Beispiele in dieser Dokumentation sind für Python erstellt.
|
||||
|
@ -80,7 +81,7 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Funktionen werden im Format `weechat::xxx arg1 arg2 ...` ausgeführt
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* Funktionen werden im Format `(weechat:xxx arg1 arg2 ...)` ausgeführt
|
||||
* folgende Funktionen nutzen eine Liste von Argumente (anstelle von vielen
|
||||
|
@ -94,6 +95,10 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Funktionen werden im Format `weechat.xxx(arg1, arg2, ...);` ausgeführt
|
||||
|
||||
==== PHP
|
||||
|
||||
* Funktionen werden im Format `weechat_xxx(arg1, arg2, ...);` ausgeführt
|
||||
|
||||
[[register_function]]
|
||||
=== Die "Register" Funktion
|
||||
|
||||
|
@ -166,7 +171,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Test Skript" "" ""
|
|||
weechat::print "" "Hallo, von einem tcl Skript!"
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -182,6 +187,18 @@ weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test Skript", "", "");
|
|||
weechat.print("", "Hallo, von einem javascript Skript!");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Test Skript', '', '');
|
||||
weechat_printf('', 'Hallo, von einem PHP Skript!');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== Laden von Skripten
|
||||
|
||||
|
@ -196,6 +213,7 @@ nutzen, zum Beispiel:
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
Es besteht natürlich weiterhin die Möglichkeit, individuell für jede
|
||||
|
@ -209,6 +227,7 @@ Skriptsprache, den entsprechenden Befehl zu nutzen:
|
|||
/tcl load script.tcl
|
||||
/guile load script.scm
|
||||
/javascript load script.js
|
||||
/php load script.php
|
||||
----
|
||||
|
||||
Um Skripten automatisch beim Start von WeeChat zu laden sollte man einen Link
|
||||
|
@ -360,7 +379,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -384,6 +403,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== Skript API
|
||||
|
||||
|
|
|
@ -23,13 +23,14 @@ light, designed for many operating systems.
|
|||
This manual documents way to write scripts for WeeChat, using one of supported
|
||||
script languages:
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
Almost all examples in this doc are written in Python, but API is the same for
|
||||
|
@ -74,7 +75,7 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Functions are called with `weechat::xxx arg1 arg2 ...`.
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* Functions are called with `(weechat:xxx arg1 arg2 ...)`.
|
||||
* Following functions take one list of arguments (instead of many arguments
|
||||
|
@ -88,6 +89,10 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Functions are called with `weechat.xxx(arg1, arg2, ...);`.
|
||||
|
||||
==== PHP
|
||||
|
||||
* Functions are called with `weechat_xxx(arg1, arg2, ...);`.
|
||||
|
||||
[[register_function]]
|
||||
=== Register function
|
||||
|
||||
|
@ -160,7 +165,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Test script" "" ""
|
|||
weechat::print "" "Hello, from tcl script!"
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -176,6 +181,18 @@ weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test script", "", "");
|
|||
weechat.print("", "Hello, from javascript script!");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Test script', '', '');
|
||||
weechat_printf('', 'Hello, from PHP script!');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== Load script
|
||||
|
||||
|
@ -189,6 +206,7 @@ It is recommended to use the "script" plugin to load scripts, for example:
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
Each language has also its own command:
|
||||
|
@ -201,6 +219,7 @@ Each language has also its own command:
|
|||
/tcl load script.tcl
|
||||
/guile load script.scm
|
||||
/javascript load script.js
|
||||
/php load script.php
|
||||
----
|
||||
|
||||
You can make link in directory _language/autoload_ to autoload script when
|
||||
|
@ -347,7 +366,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -371,6 +390,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== Script API
|
||||
|
||||
|
|
|
@ -25,13 +25,14 @@ rapide et léger, conçu pour différents systèmes d'exploitation.
|
|||
Ce manuel documente la façon d'écrire des scripts pour WeeChat, en utilisant
|
||||
l'un des langages de script supportés :
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
La majorité des exemples de cette documentation sont écrits en Python, mais
|
||||
|
@ -77,7 +78,7 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Les fonctions sont appelées par `weechat::xxx arg1 arg2 ...`.
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* Les fonctions sont appelées par `(weechat:xxx arg1 arg2 ...)`.
|
||||
* Les fonctions suivantes prennent une liste de paramètres en entrée (au lieu
|
||||
|
@ -91,6 +92,10 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Les fonctions sont appelées par `weechat.xxx(arg1, arg2, ...);`.
|
||||
|
||||
==== PHP
|
||||
|
||||
* Les fonctions sont appelées par `weechat_xxx(arg1, arg2, ...);`.
|
||||
|
||||
[[register_function]]
|
||||
=== Fonction register
|
||||
|
||||
|
@ -164,7 +169,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Script de test" "" ""
|
|||
weechat::print "" "Bonjour, du script tcl !"
|
||||
----
|
||||
|
||||
* Guile (scheme) :
|
||||
* Guile (Scheme) :
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -176,10 +181,22 @@ weechat::print "" "Bonjour, du script tcl !"
|
|||
|
||||
[source,javascript]
|
||||
----
|
||||
weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test script", "", "");
|
||||
weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Script de test", "", "");
|
||||
weechat.print("", "Bonjour, du script javascript !");
|
||||
----
|
||||
|
||||
* PHP :
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Script de test', '', '');
|
||||
weechat_printf('', 'Bonjour, du script PHP !');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== Chargement du script
|
||||
|
||||
|
@ -194,6 +211,7 @@ par exemple :
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
Chaque langage a également sa propre commande :
|
||||
|
@ -206,6 +224,7 @@ Chaque langage a également sa propre commande :
|
|||
/tcl load script.tcl
|
||||
/guile load script.scm
|
||||
/javascript load script.js
|
||||
/php load script.php
|
||||
----
|
||||
|
||||
Vous pouvez faire un lien dans le répertoire _langage/autoload_ pour charger
|
||||
|
@ -359,7 +378,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme) :
|
||||
* Guile (Scheme) :
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -383,6 +402,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP :
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== API script
|
||||
|
||||
|
|
|
@ -31,13 +31,14 @@ veloce e leggero, realizzato per molti sistemi operativi.
|
|||
Questo manuale documenta come scrivere script per WeeChat, usando uno dei
|
||||
linguaggi di scripting supportati:
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
Quasi tutti gli esempi in questo manuale sono scritti in Python, ma l'API
|
||||
|
@ -83,7 +84,7 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Le funzioni sono chiamate con `weechat::xxx arg1 arg2 ...`
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* Le funzioni sono chiamate con `(weechat:xxx arg1 arg2 ...)`
|
||||
* Le seguenti funzioni prendono un elenco di argomenti (invece di più argomenti
|
||||
|
@ -97,6 +98,10 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* Le funzioni sono chiamate con `weechat.xxx(arg1, arg2, ...);`
|
||||
|
||||
==== PHP
|
||||
|
||||
* Le funzioni sono chiamate con `weechat_xxx(arg1, arg2, ...);`
|
||||
|
||||
[[register_function]]
|
||||
=== Registrare una funzione
|
||||
|
||||
|
@ -169,7 +174,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Test script" "" ""
|
|||
weechat::print "" "Hello, from tcl script!"
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -185,6 +190,18 @@ weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test script", "", "");
|
|||
weechat.print("", "Hello, from javascript script!");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Test script', '', '');
|
||||
weechat_printf('', 'Hello, from PHP script!');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== Caricare uno script
|
||||
|
||||
|
@ -198,6 +215,7 @@ Si raccomanda di usare il plugin "script" per caricare gli script, ad esempio:
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
Ogni linguaggio ha anche il suo comando specifico:
|
||||
|
@ -210,6 +228,7 @@ Ogni linguaggio ha anche il suo comando specifico:
|
|||
/tcl load script.tcl
|
||||
/guile load script.scm
|
||||
/javascript load script.js
|
||||
/php load script.php
|
||||
----
|
||||
|
||||
È possibile creare un link nella directory _linguaggio/autoload_ per caricare
|
||||
|
@ -363,7 +382,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -387,6 +406,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== Script API
|
||||
|
||||
|
|
|
@ -29,13 +29,14 @@ WeeChat (Wee Enhanced Environment for Chat)
|
|||
このマニュアル文書は以下のスクリプト言語を利用して WeeChat
|
||||
用のスクリプトを製作する方法を解説しています:
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
この文書に含まれるほぼすべての例は Python
|
||||
|
@ -80,7 +81,7 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* 関数は `weechat::xxx arg1 arg2 ...` のように呼び出してください。
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* 関数は `(weechat:xxx arg1 arg2 ...)` のように呼び出してください。
|
||||
* 以下の関数は引数のリストをひとつだけ取ります
|
||||
|
@ -94,6 +95,10 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
|||
|
||||
* 関数は `weechat.xxx(arg1, arg2, ...);` のように呼び出してください。
|
||||
|
||||
==== PHP
|
||||
|
||||
* 関数は `weechat_xxx(arg1, arg2, ...);` のように呼び出してください。
|
||||
|
||||
[[register_function]]
|
||||
=== 関数の登録
|
||||
|
||||
|
@ -166,7 +171,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Test script" "" ""
|
|||
weechat::print "" "Hello, from tcl script!"
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -182,6 +187,18 @@ weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test script", "", "");
|
|||
weechat.print("", "Hello, from javascript script!");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Test script', '', '');
|
||||
weechat_printf('', 'Hello, from PHP script!');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== スクリプトのロード
|
||||
|
||||
|
@ -195,6 +212,7 @@ weechat.print("", "Hello, from javascript script!");
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
プログラミング言語ごとの固有コマンドを利用することもできます:
|
||||
|
@ -207,6 +225,7 @@ weechat.print("", "Hello, from javascript script!");
|
|||
/tcl load script.tcl
|
||||
/guile load script.scm
|
||||
/javascript load script.js
|
||||
/php load script.php
|
||||
----
|
||||
|
||||
WeeChat の開始時にスクリプトを自動ロードするには
|
||||
|
@ -355,7 +374,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -379,6 +398,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== スクリプト API
|
||||
|
||||
|
|
|
@ -29,13 +29,14 @@ i lekkim, zaprojektowanym dla wielu systemów operacyjnych.
|
|||
Ten dokument przedstawia sposób pisania skryptów dla WeeChat z użyciem jednego ze
|
||||
wspieranych języków skryptowych:
|
||||
|
||||
* python
|
||||
* perl
|
||||
* ruby
|
||||
* lua
|
||||
* tcl
|
||||
* guile (scheme)
|
||||
* javascript
|
||||
* Python
|
||||
* Perl
|
||||
* Ruby
|
||||
* Lua
|
||||
* Tcl
|
||||
* Guile (Scheme)
|
||||
* Javascript
|
||||
* PHP
|
||||
|
||||
[NOTE]
|
||||
Prawie wszystkie przykłady umieszczone w tym dokumencie są napisane w Pythonie,
|
||||
|
@ -80,7 +81,7 @@ Weechat.config_new_option(config, section, "nazwa", "ciąg", "opis opcji", "", 0
|
|||
|
||||
* Funkcje są wywoływane za pomocą `weechat::xxx arg1 arg2 ...`
|
||||
|
||||
==== Guile (scheme)
|
||||
==== Guile (Scheme)
|
||||
|
||||
* Funkcje są wywoływane za pomocą `(weechat:xxx arg1 arg2 ...)`
|
||||
* Następujące funkcje przyjmują pojedynczą listę argumentów (zamiast wielu
|
||||
|
@ -94,6 +95,10 @@ Weechat.config_new_option(config, section, "nazwa", "ciąg", "opis opcji", "", 0
|
|||
|
||||
* Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...);`
|
||||
|
||||
==== PHP
|
||||
|
||||
* Funkcje są wywoływane za pomocą `weechat_xxx(arg1, arg2, ...);`
|
||||
|
||||
[[register_function]]
|
||||
=== Funkcja rejestrująca
|
||||
|
||||
|
@ -166,7 +171,7 @@ weechat::register "test_tcl" "FlashCode" "1.0" "GPL3" "Skrypt testowy" "" ""
|
|||
weechat::print "" "Witaj ze skryptu tcl!"
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -178,10 +183,22 @@ weechat::print "" "Witaj ze skryptu tcl!"
|
|||
|
||||
[source,javascript]
|
||||
----
|
||||
weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Test script", "", "");
|
||||
weechat.register("test_js", "FlashCode", "1.0", "GPL3", "Skrypt testowy", "", "");
|
||||
weechat.print("", "Witaj ze skryptu javascript!");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
function __construct() {
|
||||
weechat_register('test_php', 'FlashCode', '1.0', 'GPL3', 'Skrypt testowy', '', '');
|
||||
weechat_printf('', 'Witaj ze skryptu PHP!');
|
||||
----
|
||||
|
||||
[[load_script]]
|
||||
=== Ładowanie skryptu
|
||||
|
||||
|
@ -195,6 +212,7 @@ Zaleca się używanie wtyczki "script" do ładowania skryptów, na przykład:
|
|||
/script load script.tcl
|
||||
/script load script.scm
|
||||
/script load script.js
|
||||
/script load script.php
|
||||
----
|
||||
|
||||
Każdy język posiada również swoją własną komendę:
|
||||
|
@ -207,6 +225,7 @@ Każdy język posiada również swoją własną komendę:
|
|||
/tcl load skrypt.tcl
|
||||
/guile load skrypt.scm
|
||||
/javascript load skrypt.js
|
||||
/php load skrypt.php
|
||||
----
|
||||
|
||||
Możesz zrobić dowiązanie w katalogu _język/autoload_ jeśli chcesz automatycznie
|
||||
|
@ -353,7 +372,7 @@ proc timer_cb { data remaining_calls } {
|
|||
weechat::hook_timer 1000 0 1 timer_cb test
|
||||
----
|
||||
|
||||
* Guile (scheme):
|
||||
* Guile (Scheme):
|
||||
|
||||
[source,lisp]
|
||||
----
|
||||
|
@ -377,6 +396,16 @@ function timer_cb(data, remaining_calls) {
|
|||
weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
|
||||
----
|
||||
|
||||
* PHP:
|
||||
|
||||
[source,php]
|
||||
----
|
||||
weechat_hook_timer(1000, 0, 1, function ($data, remaining_calls) {
|
||||
weechat_printf('', 'timer! data=' . $data);
|
||||
return WEECHAT_RC_OK;
|
||||
}, 'test');
|
||||
----
|
||||
|
||||
[[script_api]]
|
||||
== API skryptów
|
||||
|
||||
|
|
Loading…
Reference in New Issue