Forum

> > CS2D > General > CS2D Lua Scripting Tutorial Development
Forums overviewCS2D overviewGeneral overviewLog in to reply

English CS2D Lua Scripting Tutorial Development

74 replies
Page
To the start Previous 1 2 3 4 Next To the start

old CS2D Lua Scripting Tutorial Development

SQ
Moderator Off Offline

Quote
Since TheKilledDeath doesn't have time to work on Lua scripting tutorial, I will take his role.

> === Lua Manual Will Include ===
• Many different scripting lessons, not just basic functions.
• A lot of different Lua scripting samples with comments & explanations.
• Further tutorial versions are going to be translated to German Language.

> === You Can Suggest/Request ===
• What scripting examples should it have?
• What lessons should include?
• Should tutorial have more features? What features?

Learn Lua scripting & have fun!

old Re: CS2D Lua Scripting Tutorial Development

doom15
BANNED Off Offline

Quote
you don't even know how much i've been waitin' for somthing like this....Nice ideea.

You should add Some parts when you give Examples like For 'x ' you can use this
Spoiler >


And more parts like this.

old Re: CS2D Lua Scripting Tutorial Development

SQ
Moderator Off Offline

Quote
Probably I will make tutorial about image functions, so you will understand how to use images, sprites.

Also there will be GunGame, SuperHero scripting tutorials.

old Re: CS2D Lua Scripting Tutorial Development

Flacko
User Off Offline

Quote
DaveRodec has written
I don't need lessons from you BLazingxx, I need lessons from leegao Object orientated programming in lua for example...


Well dude, in that case you could just STFU because you don't even show a bit of interest.

old Re: CS2D Lua Scripting Tutorial Development

Flacko
User Off Offline

Quote
Heavy has written
I think you should explain File IO for saving and loading data. In python it is much easier in my opinion.

It's also easy in Lua, maybe it's just different.
Meanwhile, you can have this two functions that I used.
But first you will need this function by leegao:
1
2
3
4
5
6
7
8
9
10
11
12
function toTable(t,match)
	local cmd = {}
	if not match then
		match = "[^%s]+"
	else
		match = "[^"..match.."]+"
	end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end
	return cmd
end

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function writetofile(path, mode, dl, ...)
	local file = io.open(path, mode)
	if file then
		for i,v in ipairs(arg) do
			file:write(v)
			if i<#arg then file:write(dl) end
		end
		file:close()
		return true
	else
		return false
	end
end

function readfromfile(path,dl)
	if not dl then dl = "\n" end
	local file = io.open(path,"r")
	if file then
		local tbl = toTable(file:read("*a"),dl)
		file:close()
		return tbl
	else
		return false
	end
end
Maybe you can guess what they do by yourself
To the start Previous 1 2 3 4 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview