Reading vehicles script?

Is it possible to read a vehicles script through lua, settings such as its max, of lets say prop_vehicle_jeep?

file.Read could work. I know that lua can get all the files in a directory such as the maps folder, but idk about reading them.

Never used file.Read before, ran this console cmd to see if it works:


lua_run print(file.Read(player.GetAll()[1]:GetVehicle().VehicleTable.KeyValues.vehiclescript))

prints out nil. I’m in a vehicle, am I doing something wrong?

[editline]9th February 2011[/editline]

Just checked the gwiki for it, in additional notes: “Relative to garrysmod/data” :frowning:

By the way,it’s
[lua]
lua_run print(file.Read(player.GetAll()[1]:GetVehicle():GetKeyValues().VehicleScript,true))
[/lua]
file.Read will not output anything if the file is loaded from a .gcf,it should work fine if you are using a custom vehicle with a custom vehiclescript.
It will work on a dedicated server for sure.

GetKeyValues() is pretty expensive, I figured that with VehicleTable it just have to cycle through a small table. Tried it on SinglePlayer, doesn’t work, anyway, I’m scrapping the idea that needs this, so thanks anyway.