TH1 lappend command is broken
(1) By anonymous on 2021-09-20 09:14:03 [source]
When using the lappend var ...
command the variable var
is never created nor modified. This does not match what Tcl does where the variable is created/modified. The comment in the code for the lappend
command also says that var
is created.
Example 1 (to be tested with the test-th-eval command or the TH1 admin console):
lappend a 123
info vars
Result: a does not show upExpected: a should show up
Example 2:
set a [list]
lappend a 123
puts $a
Result: a is still emptyExpected: 123
A quick test suggests that this makes lappend
behave as expected.
Index: src/th_lang.c
==================================================================
--- src/th_lang.c
+++ src/th_lang.c
@@ -257,10 +257,11 @@
for(i=2; i<argc; i++){
Th_ListAppend(interp, &zList, &nList, argv[i], argl[i]);
}
+ Th_SetVar(interp, argv[1], argl[1], zList, nList);
Th_SetResult(interp, zList, nList);
Th_Free(interp, zList);
return TH_OK;
}
(2) By Stephan Beal (stephan) on 2021-09-20 11:54:10 in reply to 1 [link] [source]
A quick test suggests that this makes lappend behave as expected.
i recall stumbling across this recently while editing a skin, but didn't look into it. Thank you for the investigation and patch. i will get to this when i'm back on the computer.
(3) By Larry Brasfield (larrybr) on 2021-09-21 14:26:39 in reply to 1 [link] [source]
Stephan has fixed said bug. Thanks again for reporting it.