Hey, I was wondering if there was a way to get a value from the system lua, game engine lua, and T3D lua into vehicle lua, I saw at one point someone did (in this thread): Code: local cmd = obj:queueLuaCommand('return value') Then did this to retrieve the value: Code: local val = obj:getLuaResult(cmd) but that's only for T3D Lua (I believe), but even then I can't figure out how to get it to actually return a value. I also saw that you can do obj:queueGameEngineLua() to run game engine lua from vehicle lua, but it doesn't return a value. The only reason I ask is because I want to figure out a way to find the version of BeamNG.drive, so if it gets an update, my mod will auto-disable itself. If there is an easier way to find the version of BeamNG.drive in vehicle lua, please do tell! Thanks, StinchinStein P.S. I'm guessing only the dev's would know how to answer this, but I might be wrong.
Hey, there's actually no easy solution. The problem is that there're several virtual machine for the lua code. For example we have a gameengine virtual machine, a vehicle virtual machine etc. So if you execute your code within the game engine virtual machine your code needs to look like this: Code: be:getPlayerVehicle(0):queueLuaCommand("obj:queueGameEngineLua('myValue = ('..electrics.values['fuel']..')')") It's a bit like ping pong. You execute code from game engine lua to execute vehicle lua code to pass the value to game engine lua again. The other side of the shield is that it's not executed in 'real time' since your queuing the commands.
How would I go about doing this for getting GameEngine Lua values in VLua? If it's not possible, that's fine.
It's possible. Can you post a specific example of what you want to do? eg the name of a variable you want to get back into vlua --- Post updated --- OK, I thought of an example variable in GE Lua, so here is some (tested) code which works: Code: obj:queueGameEngineLua("be:getPlayerVehicle(0):queueLuaCommand('torsionTest = (\"'..Steam.playerName..'\")')") Note that we're dealing with a string here. If you were dealing with a non-string something different might need to be done.