Forum

> > CS2D > Scripts > string expected got table
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch string expected got table

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt string expected got table

Mami Tomoe
User Off Offline

Zitieren
1
2
3
4
5
6
7
(this is line #358)elseif cmd =="!pm" then
			local pl=tonumber(p[2])
			local msg=string.sub(p,6)
			if msg ~= nil and player(pl,"exists") then
				msg2(pl,"\169000255000From "..player(id,"name")..": "..msg)
				msg2(id,"\169000200000To "..player(pl,"name")..": "..msg)
			end

I get the error on the third line saying:
1
2
3
4
5
LUA ERROR: sys/lua/7-Admin/main.lua:360: bad argument #1 to 'sub' (string expected, got table)
 -> [C]: in function 'sub'
 -> sys/lua/7-Admin/main.lua:360: in function 'ParseCommand'
 -> sys/lua/engine.lua:914: in function <sys/lua/engine.lua:912>
 -> in Lua hook 'say', params: 1, '!pm'

I have no clue how tables and strings work so...

Oh and pls

alt Re: string expected got table

Yates
Reviewer Off Offline

Zitieren
Edit: Uh, lol. Nevermind.

What does p contain? You are trying to string.sub with the first parameter being a whole table, you need to use an entry.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht