Forum

> > CS2D > Scripts > Tabbed lua
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Tabbed lua

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Tabbed lua

limonata
User Off Offline

Zitieren
Hi guys I sent a lua to an user in unreal software and he said me "put tabs" I couldnt understand then he sent me this.

"Tabbed" script:
1
2
3
4
5
6
addhook('say', 'ss')
function ss(id, text)
     if text == "Hello" then
          msg("hello")
     end
end

"Untabbed" script:
1
2
3
4
5
6
addhook('say', 'ss')
function ss(id, text)
if text == "Hello" then
msg("hello")
end
end

Now I want to learn will you use any program while you are making lua? If you are, then is program puts tabs automatically? or You are put with your hand ? And please tell me How I can convert any lua to tabbed.
Thanks.

alt Re: Tabbed lua

Starkkz
Moderator Off Offline

Zitieren
I use Notepad++, but as far as I know it doesn't put automatically tabs. Anyway you can use the key that is at the left side of the "Q", it will make tabs.

Just make sure that you will put them after conditionals and functions.
1
2
3
4
5
6
7
8
function hereIsMyFunction()
	-- here comes the first tab
	if (my conditional) then
		-- the second tab
	end
	
	-- reduce to the first tab again
end

alt Re: Tabbed lua

limonata
User Off Offline

Zitieren
hm Okay thanks for your reply. I use notepad too but it doesnt show mistake with red line or what else. When I trying the lua I see mistakes in console. But I want see before I work lua.

alt Re: Tabbed lua

Starkkz
Moderator Off Offline

Zitieren
Well, it is because if you don't put tabs it won't throw you an error. Tabs are optional, but they can help you to find out what are the bugs on your script.

alt Re: Tabbed lua

SD
User Off Offline

Zitieren
Tabbing your code won't help you to find errors, it will just make it readable for others. Unless you're writing in Python, of course. That way you must use proper indentation. So next time you're writing a script you're gonna upload somewhere (or send someone), it's always a very good idea to use correct or at least readable indentation.

alt Re: Tabbed lua

FlammerD
User Off Offline

Zitieren
user SD hat geschrieben
Tabbing your code won't help you to find errors, it will just make it readable for others.

alt Re: Tabbed lua

ohaz
User Off Offline

Zitieren
user SD hat geschrieben
Tabbing your code won't help you to find errors, it will just make it readable for others.
Not completely right. It might help you find errors when you're missing an "end" for example.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht