I know that I have a poor grasp of these concepts, so I apologize in advance. Please help me understand this command in more detail, beyond the scope already explained in this post: Code: be:getPlayerVehicle(0):queueLuaCommand("obj:queueGameEngineLua('myValue = ('..electrics.values['fuel']..')')") I understand the general purpose of the code - it should set a variable in one VM to a value found in another VM. I've read that the colon operator makes be:getPlayerVehicle(0) the equivalent of be.getPlayerVehicle(be,0) in the Lua docs. I could really use some more handholding though: What is the "be" variable? (BeamEngine? Why does this need the colon operator instead of just a period?) What is the "obj" variable? What is it doing for us here? I'm a little confused by the repeated use of the colon operator. Maybe it's not doing what I think it's doing here? The example code is for copying the value of electrics.values.fuel in the Vehicle Lua VM over to myValue in the GE Lua VM... right? I simply don't understand how this code copies the data from one VM to another. Please give more details on what the code is doing to achieve that. Walking me through what happens step by step would be useful. EDIT: Maybe I just need help detangling all the nested quotes? Maybe everything would be clear if I had a handle on that?
As for the colon , see this : http://stackoverflow.com/a/4911217/2377834 As for the rest: be is indeed BeamEngine obj represents the vehicle obj:queueGameEngineLua executes code on the game engine side. In this case, it sets a global variable myValue inside of the game engine Lua.
Thanks Dummiesman. That helped! I still don't have a strong handle on the colon operator. It is easy to understand precisely what it does, my trouble comes from why we need to do it in some cases. It seems to be related to an OO concept which I don't know about or comprehend. :-/ In cases like the example I can become very confused by concatenation. After I took the guts of the double-quoted section out and put it on it's own line syntax highlighting kicked in and helped me figure out what was going on with that. It especially helped that you mentioned that "obj" represents the vehicle. EDIT: To clarify for anyone else who comes to this thread looking for answers - working in VM (a) we concatenate a variable from VM (a) into the command to assign a value to a variable in VM (b). So when the command runs in VM (b) it's not an assignment from one variable to another - it's assigning a static value to the variable. (eg the static value between the concatenation operators "..")