Forum

> > CS2D > Scripts > String expected, got table [HC]
Forums overviewCS2D overview Scripts overviewLog in to reply

English String expected, got table [HC]

4 replies
To the start Previous 1 Next To the start

old String expected, got table [HC]

Mami Tomoe
User Off Offline

Quote
The error:
1
Error: sys/lua/hc/modules/automod.lua:44: bad argument #1 to 'match' (string expected, got table)

The code:
More >

The table:
1
2
3
4
5
6
hc.CENSORED_NAMES = {
{"[Ff][Uu][Cc][Kk]"},
{"[Dd][Ii][Cc][Kk]"},
{"[Pp][Ee][Nn][Ii][Ss]"},
{"[Nn][Aa][Zz][Ii]"}
}

Can someone please help me?
While your at it don't fear to tell me what was wrong so I can learn from my mistakes
Script: HC Admin Script [Latest]

No pressure

old Re: String expected, got table [HC]

Yates
Reviewer Off Offline

Quote
The error is quite self-explanitory, you are passing a table instead of a string. This is because your table hc.CENSORED_NAMES contains four tables with content. I am not sure what you want but I believe you want this instead:

1
2
3
4
hc.CENSORED_NAMES = {
	"[Ff][Uu][Cc][Kk]",
	etc ...
}

I am not familiar with the HC script, so I don't know if things like [Ff][Uu][Cc][Kk] will even work.

old Re: String expected, got table [HC]

EngiN33R
Moderator Off Offline

Quote
I think you messed up your name definitions. You don't need to surround each name with curly braces ({}). Your table should simply be this:

1
2
3
4
5
6
hc.CENSORED_NAMES = {
    "[Ff][Uu][Cc][Kk]",
    "[Dd][Ii][Cc][Kk]",
    "[Pp][Ee][Nn][Ii][Ss]",
    "[Nn][Aa][Zz][Ii]"
}
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview