#guys pls give some lessons on Roblox studio lua.

1 messages · Page 1 of 1 (latest)

light lark
#

pls

heady edge
peak orbit
#
local cat = "bob"

local function Cat(dog)
  print(dog)
  return 69
end

print(Cat(cat))

what will this print and why?

heady edge
#
#include <stdio.h> 
int main() 
{ 
    int a = 10, b = 0, c = 10; 
    char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " 
                "TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBL" 
                "OFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm " 
                "SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; 
    while (a != 0) 
    { 
    a = str[b++]; 
        while (a-- > 64) 
        { 
            if (++c == 90) 
            { 
                c = 10;      
                putchar('\n'); 
            } 
            else 
            { 
                if (b % 2 == 0) 
                    putchar('!'); 
                else 
                    putchar(' '); 
            } 
        } 
    } 
    return 0; 
} 
#

what does this do

#

this is pretty easy

#

you should get this first try

heady edge
#

lua real

nova willow
#

cuz i saw

#

; at the end

#

and jave uses it in every method you make

nova willow
# light lark pls
local wavefunctionMetatable = {
  __add = function(wf1, wf2)
    assert(#wf1 == #wf2, "Wavefunctions must have the same number of coefficients")
    
    local result = setmetatable({}, wavefunctionMetatable)
    
    for i = 1, #wf1 do
      result[i] = wf1[i] + wf2[i]
    end
    
    return result
  end,
  
  __mul = function(wf1, wf2)
    assert(#wf1 == #wf2, "Wavefunctions must have the same number of coefficients")
    
    local innerProduct = 0
    for i = 1, #wf1 do
      innerProduct = innerProduct + wf1[i] * wf2[i]
    end
    
    return innerProduct
  end
}

local wf1 = setmetatable({1, 0, 0, 0}, wavefunctionMetatable)

local wf2 = setmetatable({0, 1 / math.sqrt(2), 1 / math.sqrt(2), 0}, wavefunctionMetatable)

local wfSum = wf1 + wf2

local innerProduct = wf1 * wf2
nova willow
#

because the param is looking for dog

#

and the argument that you gave was the cat

#

which is = bob

#

so it would print bob

gray zenith
#

hmm, Cat, is the funtion that accepts one variable and calls that variable dog, it then gets passed the variable value defined as cat which equals bob, so inside the Cat function , print(dog) will print the value that was was passed , which is bob. then the Cat function with the return, returns a static value of 69, and then last print then prints what was returned by the function Cat, which is 69. So you would see bob and 69 in the output

mystic nest
heady edge
#

moon runes