• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction !online viewed as a book, TFS 1.1

stop making it even more complicated.

I simply prefer easy to read codes.
And if you scared about attacks as pathetic as this, then set some exhaust time using supportive commands.
 
stop making it even more complicated.

I simply prefer easy to read codes.
And if you scared about attacks as pathetic as this, then set some exhaust time using supportive commands.
Code:
local ret = {}
local str = 'retard'
for i = 1, 100 do
    table.insert(ret, str)
end
print(table.concat(ret, ' '))

local ret = ''
local str = 'retard'
for i = 1, 100 do
    ret = ret .. str
end
print(ret)
tell me the difference readability between these two codes that lets you say its easy to read code
theyre the same amount of lines but one is worse to do
more complicated wut
 
Last edited:
stop making it even more complicated.

I simply prefer easy to read codes.
And if you scared about attacks as pathetic as this, then set some exhaust time using supportive commands.
IjMgTBG.png
 
Code:
local ret = {}
local str = 'retard'
for i = 1, 100 do
    table.insert(ret, str)
end
print(table.concat(ret, ' '))

local ret = ''
local str = 'retard'
for i = 1, 100 do
    ret = ret .. str
end
print(ret)
tell me the difference readability between these two codes that lets you say its easy to read code
theyre the same amount of lines but one is worse to do
more complicated wut
EDITED
Cant you see the difference yourself? in first solution i see 1 more line.
in second solution empty string isn't necessary in this case
and using a function, means the person who reads the code needs to know what does that function do.

You don't all have to go ape on me just because I have different view how to write code.
Just live with it..
 
Last edited:
Cant you see the difference yourself? in 1 solution i see 2 more lines.

You don't all have to go ape on me just because I have different view how to write code.
Just live with it..
both solutions have 2 lines for 2 locals
both solutions have 3 lines for a loop
both solutinos have 1 line for the return
????????????????????????????????????????
 
Cant you see the difference yourself? in 1 solution i see 2 more lines.

You don't all have to go ape on me just because I have different view how to write code.
Just live with it..
might need glasses tbh
if you already have them you need glasses for your glasses
 
both solutions have 2 lines for 2 locals
both solutions have 3 lines for a loop
both solutinos have 1 line for the return
????????????????????????????????????????
Ah ye my bad, but still making empty string wasn't needed in the first solution.
 
Ah ye my bad, but still making empty string wasn't needed in the first solution.
if you concat str with str you continuously add itself and it becomes massive
str = retard + retard
str (retard + retard) + retard + retard (4 retards)
4 retards + 4 retards -> 8
so forth
edit: also your memory will get stomped in the loop doing that :)
 
o wow i fail hard this night xD
Well yeah, actually your examples are ok.
Yet I would still use the first example.

no idea why i though first example should take less code lines to write.
Anyway, still kinda rude pseudocode and the way you all boss it off didn't make me feel to doublecheck anything.
As there is nothing to learn here. Pretty random topic. Im off
 
Okay guys, remember this is an otserver and the player count will hardly pass 1000 and for 1000 concatenations this is going to take little time and the extra memory used will get collected eventually, you don't need to bitch about this in that case, but you could use string.format to do the concatenations. It's nowhere near as good as the buffer solution but it's faster and it will expend less memory:
Code:
msg = string.format("%s[%d] %s [%d]\n", msg, i, targetPlayer:getName(),  targetPlayer:getLevel())

Using table.concat is overkill in that situation.
 
Back
Top