Getting obj:queueGameEngineLua() to return a value

Discussion in 'Programming' started by TheStatPow, Nov 17, 2015.

  1. TheStatPow

    TheStatPow
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    145
    Is it possible to make obj:queueGameEngineLua() return a value?
    Because writting all my code in one line is painful.

    I tried:

    value_from = obj:queueGameEngineLua('return value')
    value_from = obj:queueGameEngineLua('value')
     
  2. Scepheo

    Scepheo
    Expand Collapse

    Joined:
    Feb 10, 2015
    Messages:
    601
    Code:
    local command = obj:queueLuaCommand('return value')
    local result = obj:getLuaResult(command)
    Although I think at least one physics step has to occur between the two calls.

    EDIT: Actually, if your problem is writing all your code in a single line, there's also the option of using the [[ and ]] string delimiters. This allows your strings to span multiple lines:
    Code:
    obj:queueLuaCommand(
    [[
        local value = someFunction()
        local otherValue = someOtherFunction(value)
    ]])
     
    • Like Like x 2
  3. TheStatPow

    TheStatPow
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    145

    Thanks!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice