Hi, how can I get an assignment statement to return the output of a function like in the example below?
-- Clarified example
local emptyVar = nil
local varExample = if (emptyVar) then "false" else function()
return "I'd like this to return"
end
print(varExample)
-- What I need it for, probably don't look at this tbh
local spawningData = allBulletsInCoeval[possiblyMissingLocationData]
allBulletsInCoeval[possiblyMissingLocationData] = if not spawningData then {0, 0, 0} else if (possiblyMissingLocationData == 1) then function()
local rotationalAbode = {}
for rotationalComponent = 1, 3 do
table.insert(rotationalAbode, math.rad(spawningData[rotationalComponent]))
end
return rotationalAbode
end
I don’t think it’s possible the way your doing it, however, you could do it like this:
function rotateAbode() --Call this what you want
local rotationalAbode = {}
for rotationalComponent = 1, 3 do
table.insert(rotationalAbode, math.rad(spawningData[rotationalComponent]))
end
return rotationalAbode
end
allBulletsInCoeval[possiblyMissingLocationData] = if not spawningData then {0, 0, 0} else if (possiblyMissingLocationData == 1) then rotateAbode()
Thanks, this is what I am looking for. I tried to get
local emptyVar = nil
local varExample = if (emptyVar) then "false" else if (1 + 1 == 2) then (function()
return "I'd like this to return"
end)()
print(varExample)