scandum / tintin

TinTin++, aka tt++, is an extensible console MUD client.
https://tintin.mudhalla.net
GNU General Public License v3.0
201 stars 56 forks source link

When #class save/clear/load and tables are combined, a bug occurs #135

Closed dzpao closed 2 years ago

dzpao commented 2 years ago

Minimal reproducible example:

#alias {bug1} {
    #class foo open;
    #function foo {
        #local str {hello};
        #return {{text}{$str}};
    };
    #class foo close;

    #class foo;
    test-bug;

    #class foo save;
    #class foo clear;
    #class foo load;

    #class foo;
    test-bug;
};

#alias {test-bug} {
    #local r {@foo{}};
    #if { "$r[text]" != "" } {
        #echo {OK};
    };
    #else {
        #echo {Found BUG};
    };
};
bug1
##################################### foo ######################################
#FUNCTION {foo} {#local str {hello};#return {{text}{$str}};}
OK
##################################### foo ######################################
#FUNCTION {foo} {#local str {hello};#return {text}{$str}}
Found BUG

It looks a little strange. If we replace the table with a plain string, this issue does not occur.

scandum commented 2 years ago

Thanks, little oversight in the #write handling. This should be fixed in the beta.

https://mudhalla.net/tintin-beta.tar.gz

dzpao commented 2 years ago

Thank you. It has been fixed indeed.