#modul script

1 messages · Page 1 of 1 (latest)

fiery ibex
#

ive been looking to know more about module scripts but the documentation doesnt say much about it, i know you can use it as a global function, but are there any other uses for it? ive heard about things like "metatables" from it but i've never learned what they do

earnest oasis
#

just put on a tutorial about module scripts

fiery ibex
#

but what is a metatable

earnest oasis
fiery ibex
#

i DO know how to make global functions and stuff

#

i have used them before

earnest oasis
timid grailBOT
#

studio** You are now Level 12! **studio

fiery ibex
#

yes they are?

#

well i guess they arent

#

but they can be used as one

earnest oasis
earnest oasis
#

first understand what is a module script

#

than worry about metatable

frosty umbra
fiery ibex
#

thats like the only use i know about them

fiery ibex
earnest oasis
fiery ibex
# earnest oasis what is a module script

a script that can contain multiple different things it can do that can be called by any script, local or server, and the called function will be ran on the context of the script called

#

the only USE i know of is global functions but i've heard theres more uses

#

im just looking to know what those are

earnest oasis
#

on a deeper level module script gets ran once when it's required for the first time

#

and then put into memory

#

later calls will use the one in memory without running the module again

#

so basically it's a table

#

actually no

#

it's a value

#

any value

#

module scripts are huge values

fiery ibex
#

oh alright

fiery ibex
earnest oasis
#

stroing anything

fiery ibex
#

like how

earnest oasis
#

local module = {}
module.myValue = 10
return myValue

#

you don't understand modules if you don't understand what I'm talking about

fiery ibex
#

ah alright

#

and if i were to set myValue to 20 on a script, would it return 10 or 20 on a different script?

sly thicket
#

if im not mistaken you can store literally anything. lists, variables, functions, anything you want. you just use modules when you wanna use the stored info in multiple scripts

blissful oasis
rotund siren
earnest oasis
#

that's it

#

if you have a table it's a table

#

if you have a number it's a number

blissful oasis
#

Ill keep it mind

fiery ibex
#

i have learned how a module script works