As far as I am aware you can't embed Lua into a jBeam file. They should be separate files. It would help a lot if you gave more information about what you are wanting to achieve. As far as I am aware if you create a folder called "lua" in the same directory as your main jbeam file any lua files within that folder should run when your vehicle is loaded. However I could be wrong about that. Here is some general wiki stuff about how to access your vehicle data from within your lua code which may or may not be helpful to you: http://wiki.beamng.com/Streams
I would like to run a lua code: sounds.test() if the player choose the police variant of the moonwalk. But only if he choose the police. Thanks http://www.beamng.com/resources/police-lightbar-sound-mod.1749/
I haven't responded because I don't know of a good way of doing that. The only thing I could come up with was making the police variant have an engine that revs 1rpm higher and using that to detect which variant the player has loaded. Which could work but is a pretty rubbish solution.
It's a bit overkill but you can create a specific controller for this case which gets loaded from jbeam only for that specific part. Certainly will work as you want it to work. Take a look at the ETK post crash brake controller.