1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

doc: add note about constants in lua, fix lua example (scripting guide)

This commit is contained in:
Sebastien Helleu
2013-03-24 18:10:21 +01:00
parent a08603c24c
commit fad848bf7c
6 changed files with 22 additions and 6 deletions
+4 -1
View File
@@ -71,6 +71,9 @@ Lua
^^^
* Funktionen werden im Format `weechat.xxx(arg1, arg2, ...)` ausgeführt
// TRANSLATION MISSING
* Constants in API are in fact functions, the returned value must be used as
constant (not the function itself).
Tcl
^^^
@@ -331,7 +334,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")
+3 -1
View File
@@ -70,6 +70,8 @@ Lua
^^^
* Functions are called with `weechat.xxx(arg1, arg2, ...)`
* Constants in API are in fact functions, the returned value must be used as
constant (not the function itself).
Tcl
^^^
@@ -323,7 +325,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")
+3 -1
View File
@@ -72,6 +72,8 @@ Lua
^^^
* Les fonctions sont appelées par `weechat.xxx(arg1, arg2, ...)`
* Les constantes dans l'API sont en fait des fonctions, la valeur retournée doit
être utilisée comme constante (et non la fonction elle-même).
Tcl
^^^
@@ -333,7 +335,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")
+4 -1
View File
@@ -72,6 +72,9 @@ Lua
^^^
* Le funzioni sono chiamate con `weechat.xxx(arg1, arg2, ...)`
// TRANSLATION MISSING
* Constants in API are in fact functions, the returned value must be used as
constant (not the function itself).
Tcl
^^^
@@ -336,7 +339,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")
+4 -1
View File
@@ -63,6 +63,9 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
==== Lua ====
* 関数は `weechat.xxx(arg1, arg2, ...)` のように呼び出してください。
// TRANSLATION MISSING
* Constants in API are in fact functions, the returned value must be used as
constant (not the function itself).
==== Tcl ====
@@ -316,7 +319,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")
+4 -1
View File
@@ -71,6 +71,9 @@ Lua
^^^
* Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...)`
// TRANSLATION MISSING
* Constants in API are in fact functions, the returned value must be used as
constant (not the function itself).
Tcl
^^^
@@ -327,7 +330,7 @@ Weechat.hook_timer(1000, 0, 1, "timer_cb", "test");
----------------------------------------
function timer_cb(data, remaining_calls)
weechat.print("", "timer! data="..data)
return weechat.WEECHAT_RC_OK
return weechat.WEECHAT_RC_OK()
end
weechat.hook_timer(1000, 0, 1, "timer_cb", "test")