of     2   
chevron_rightchevron_rightchevron_right

AbstractMadness
#159654186Wednesday, April 08, 2015 12:39 AM GMT

local dictionary = { ["Hello"] = "world", ["Swag"] = "too much" } print(#dictionary) make it print 2
JarodOfOrbiter
#159654219Wednesday, April 08, 2015 12:40 AM GMT

Create your own length function.
cntkillme
#159654273Wednesday, April 08, 2015 12:40 AM GMT

local count = 0; for key in next, dictionary do count = count + 1; end
eLunate
#159654329Wednesday, April 08, 2015 12:41 AM GMT

function getn(t) local r = 0; for _ in next,t do r = r+1; end; return r end Ye
chimmihc
#159654351Wednesday, April 08, 2015 12:41 AM GMT

But you got to make it recurse :( ADD RECURSE FUNCTION I script -~ chimmihc
AbstractMadness
#159654357Wednesday, April 08, 2015 12:41 AM GMT

thx
AbstractMadness
#159654426Wednesday, April 08, 2015 12:42 AM GMT

@chim wat? y recurse? this is fine.
chimmihc
#159654492Wednesday, April 08, 2015 12:43 AM GMT

y no dis {fish = {noob = {hi = {a = {etc = {etc = {}}}}}}} WOT I script -~ chimmihc
AbstractMadness
#159654542Wednesday, April 08, 2015 12:44 AM GMT

becos i dont care about stupid sub dicitonaries or w/e they're called
JarodOfOrbiter
#159654813Wednesday, April 08, 2015 12:48 AM GMT

Why would you recursively find the number of elements in a table? I can't think of a reason for that.
chimmihc
#159654916Wednesday, April 08, 2015 12:50 AM GMT

Cuz must find amount of total indices. I script -~ chimmihc
KOTwarrior
#159655118Wednesday, April 08, 2015 12:53 AM GMT

local dictionary = { ["Hello"] = "world", ["Swag"] = "too much" } local k = next(dictionary); local n = 0; while k do n = n + 1; k = next(dictionary, k); end
cntkillme
#159655464Wednesday, April 08, 2015 12:58 AM GMT

what a punk using next, pairs is next but has a better name hahahahha local mytbl = {a = 5; b = 10;}; local iter = pairs({}); local x, t = nil, 0; while true do local val = iter(mytbl, x); if val ~= nil then x = val; else break; end t = t + 1; end print(t);
KOTwarrior
#159655601Wednesday, April 08, 2015 1:00 AM GMT

cnt is love, cnt is life ok
JarodOfOrbiter
#159655642Wednesday, April 08, 2015 1:00 AM GMT

Does that work, KOT? I thought the second argument of next needed to be an integer, not a value... lol my script is shorter than urs local k = pairs(dictionary) local n = 0 while k() do n = n + 1 end
cntkillme
#159655724Wednesday, April 08, 2015 1:01 AM GMT

that wouldn't work hahahahahahhahaha and also if next only took integers how do you suppose it keeps track of non-numerical indices :(
JarodOfOrbiter
#159656343Wednesday, April 08, 2015 1:09 AM GMT

Really? I thought it only worked on integers. look: local A = 0 local function Test(B, C) print(B, C) A = A + 1 if A <= 10 then return 2 end end for _ in Test, {} do end It always appends an integer value to the function you give it such as "in next, Table do"
JarodOfOrbiter
#159656469Wednesday, April 08, 2015 1:11 AM GMT

And why wouldn't my script work?
cntkillme
#159656610Wednesday, April 08, 2015 1:13 AM GMT

For one, pairs is a stateless iterator so it requires the last key (like next). For two, pairs returns next, which in turn requires a table.
eLunate
#159656618Wednesday, April 08, 2015 1:13 AM GMT

for nextVar, ..., somethingIdkWhatThisDoes in Func, arg2invariable, prevVar do And then prevVar becomes nextVar and stuff ans Func is called with arg2invariable and prevVar
JarodOfOrbiter
#159656635Wednesday, April 08, 2015 1:13 AM GMT

Never mind, you're right. I guess I wasn't testing it right the other day. Strange.
JarodOfOrbiter
#159656723Wednesday, April 08, 2015 1:15 AM GMT

Oh, so that's what stateless means. o_o
JarodOfOrbiter
#159656762Wednesday, April 08, 2015 1:15 AM GMT

Iterators are so not my thing.
JarodOfOrbiter
#159656878Wednesday, April 08, 2015 1:17 AM GMT

Then again, that might be a result of nobody answering my questions related to them.
cntkillme
#159656923Wednesday, April 08, 2015 1:18 AM GMT

[ Content Deleted ]

    of     2   
chevron_rightchevron_rightchevron_right