Hi, just wondering if anyone has a good solution of getting values from lua in javascript. To be specific, getting color palettes from lua and using that as a variable in Javascript. Code: TorqueScript.eval([[getVehicleColorPalette(0);]])
In order to get the value from a Lua function it needs to return some value: Code: local function getVehicleColorPalette() return someVehicleColorPalette end Then in JS you will need to call the Lua function and it will return the value: Code: bngApi.engineLua('my_extension.getVehicleColorPalette()', function(data) { // assign value returned from Lua var returnedValue = data; });