#Which method is better?

29 messages · Page 1 of 1 (latest)

mortal mason
#

a table would probably be the easiest way of going about it

surreal kettle
#

is it possible to find all children with the same name in a folder?

mortal mason
#

yes but why would you want that?

#

you're best off just making a script that manages the data instead

#

So player X mines 1 stone:
then in the table for player X you just add 1 to the stone value

noble dagger
#

looking through tables take performance so if you plan to constantly check the table values id suggest doing actual values instead

#

either or works but really depends

mortal mason
noble dagger
#

i see

mortal mason
#

I do have to quickly add that it really depends on how you handle resources. If they're just numbers then tables. If they're all their own item then use values

surreal kettle
#

alr, ty

lapis ingot
#

I believe tables are more convenient and flexible

#

however, you may encounter problems sharing this table between scripts

#

search up what is single script architecture

#

it help with thatreally well

#

oh also theres _G (i forgot it existed)

surreal kettle
#

i plan on adding quite a lot of ores, and since you would probably have more than a 100 of some ores at a time it could cause lag, which is my worry.

surreal kettle
lapis ingot
mortal mason
mortal mason
lapis ingot
#

yes me too

mortal mason
#

Most scripters just say "Hey I already have a module, why not just add it to the module if I need it everywhere"

lapis ingot
mortal mason
# surreal kettle ill do that, thanks
local ExampleTable = {
["Stone"] = 0,
["Iron"] = 0,
["Gold"] = 0
}

local function AddOre(Ore, NumberToAdd)
  if not ExampleTable[Ore] then warn("This ore does not exist") return end
  ExampleTable[Ore] += NumberToAdd
end
#

then it doesn't matter how many hours need to be added, as long as it stays under the intlimit (which is already way too high)

mortal mason
surreal kettle