- Joined
- Jul 10, 2007
- Messages
- 6,306
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Okay, it looks decent. It has its uses, I guess. Not as many as Romek's string separator, but still.
I'll give it an approval. But don't take that too serious.
"1"("2.1"("3.1")("3.1")"2.2")"1.2"
1, (1), 1.2
(1): (inside of 1)
2.1, (2), (3), 2.2
(2): (inside of 2)
3.1
(3): (inside of 3)
3.1
After reading the tutorial a bit I think this is the best documentated code ever :O The coding is nice too and it will be very useful for some people.
public method pop takes nothing returns thistype
//recycle node
set stackRecycle[stackRecycleCount] = this
set stackRecycleCount = stackRecycleCount + 1
return next
endmethod
public method pop takes nothing returns thistype
//recycle node
set stackRecycle[stackRecycleCount] = this
set stackRecycleCount = stackRecycleCount + 1
//if node is a pointer to a stack, destroy the stack it points to
if (type == StringType.STACK) then
call stack.destroy()
endif
return next
endmethod
type color extends string
type playercolor extends color
playercolor red
playercolor blue
color black
type race extends string
race O
race U
race H
race N
local StringStack stack = String.Parse("O 1 U 2.53 H 1.2424 N 16")local StringStack stack = String.Parse("O,1 U,2.53 H,1.2424 N,16")String.parse(string)
loop
//whenever encountering a math symbol, join left and right
//if left is stack, get result of stack using a nifty loop
//if right is stack, get result of stack using a nifty loop
endloop
loop
//whenever encountering a math symbol, add space to left and right of it
endloop
call String.parse(str)
loop
//do maths
endloop
local integer i = SuperTypes.maxsize
local string v
local SuperType superType = 0
loop
exitwhen i == 0 or superType != 0
set v = SubString(str, pos, pos+i)
set superType = LoadInteger(SuperTypes.table, StringHash(v), 0)
set i = i - 1
endloop
if (superType != 0)
//allocate new node and finish off last
set pos = pos+i+1
endif
local StringStack gg = String.parse("x=1+5*16(18+14)-12 loop(CreateUnit(player1|player2|player3||player4&&player5|player6(bonus*3)) x-- until x==0))")set x = 1+5*16*(18+14)-12
loop
CreateUnit(player1)
CreateUnit(player2)
if (player3.inGame) then
CreateUnit(player3)
else
CreateUnit(player4)
CreateUnit(Player5)
endif
local integer i = bonus*3
loop
exitwhen i == 0
CreateUnit(Player6)
set i = i - 1
endloop
set x = x - 1
exitwhen x == 0
endloop
