mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-23 01:02:23 +08:00
lua io.exists (#2771)
This commit is contained in:
27
docs/lua/tables/io.md
Normal file
27
docs/lua/tables/io.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Table: io
|
||||
|
||||
Table for file manipulation. Modified for security purposes.
|
||||
|
||||
## Functions (2)
|
||||
|
||||
### `open()`
|
||||
|
||||
- **Returns:**
|
||||
- `file_handle`: file handle or nil if can't read / write to the given path.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
file_handle = io.open()
|
||||
```
|
||||
|
||||
### `exists()`
|
||||
|
||||
- **Returns:**
|
||||
- `boolean`: True if the passed file path exists
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
boolean = io.exists()
|
||||
```
|
||||
|
||||
|
@ -6,58 +6,80 @@ Table containing functions for getting information about vehicles in GTA V.
|
||||
|
||||
### `get_vehicle_display_name(vehicle_hash)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(vehicles.get_vehicle_display_name('BTYPE2'))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `vehicle_hash` (Hash): JOAAT hash of the vehicle.
|
||||
|
||||
- **Returns:**
|
||||
- `vehicle_display_string`: String: the in-game display string. If the vehicle is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
vehicle_display_string = vehicles.get_vehicle_display_name(vehicle_hash)
|
||||
```
|
||||
|
||||
### `get_vehicle_display_name(vehicle_name)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(vehicles.get_vehicle_display_name('BTYPE2'))
|
||||
```
|
||||
|
||||
### `get_vehicle_display_name(vehicle_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `vehicle_name` (String): Name of the vehicle.
|
||||
|
||||
- **Returns:**
|
||||
- `vehicle_display_string`: String: the in-game display string. If the vehicle is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(vehicles.get_vehicle_display_name('BTYPE2'))
|
||||
vehicle_display_string = vehicles.get_vehicle_display_name(vehicle_name)
|
||||
```
|
||||
|
||||
### `get_all_vehicles_by_class(vehicle_class)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
local sports_classics = vehicles.get_all_vehicles_by_class('Sports Classics')
|
||||
for i = 1, #sports_classics do
|
||||
log.info(sports_classics[i])
|
||||
end
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `vehicle_class` (String): The vehicle class.
|
||||
|
||||
- **Returns:**
|
||||
- `vehicles`: table<int, String>: a list of all vehicles that match the class passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
local sports_classics = vehicles.get_all_vehicles_by_class('Sports Classics')
|
||||
for i = 1, #sports_classics do
|
||||
log.info(sports_classics[i])
|
||||
end
|
||||
vehicles = vehicles.get_all_vehicles_by_class(vehicle_class)
|
||||
```
|
||||
|
||||
### `get_all_vehicles_by_mfr(manufacturer)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
local albanies = vehicles.get_all_vehicles_by_mfr('Albany')
|
||||
for i = 1, #albanies do
|
||||
log.info(albanies[i])
|
||||
end
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `manufacturer` (String): The vehicle manufacturer.
|
||||
|
||||
- **Returns:**
|
||||
- `vehicles`: table<int, String>: a list of all vehicles that match the manufacturer passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
local albanies = vehicles.get_all_vehicles_by_mfr('Albany')
|
||||
for i = 1, #albanies do
|
||||
log.info(albanies[i])
|
||||
end
|
||||
```
|
||||
vehicles = vehicles.get_all_vehicles_by_mfr(manufacturer)
|
||||
```
|
||||
|
||||
|
||||
|
@ -6,38 +6,42 @@ Table containing functions for getting information about weapons in GTA V.
|
||||
|
||||
### `get_weapon_display_name(weapon_hash)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_display_name(joaat('WEAPON_REVOLVER')))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_hash` (Hash): JOAAT hash of the weapon.
|
||||
|
||||
- **Returns:**
|
||||
- `weapon_display_name`: String: the in-game display string. If the weapon is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_display_name(joaat('WEAPON_REVOLVER')))
|
||||
weapon_display_name = weapons.get_weapon_display_name(weapon_hash)
|
||||
```
|
||||
|
||||
### `get_weapon_display_name(weapon_name)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_display_name('WEAPON_REVOLVER'))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_name` (String): Name of the weapon.
|
||||
|
||||
- **Returns:**
|
||||
- `weapon_display_name`: String: the in-game display string. If the weapon is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_display_name('WEAPON_REVOLVER'))
|
||||
weapon_display_name = weapons.get_weapon_display_name(weapon_name)
|
||||
```
|
||||
|
||||
### `get_all_weapons_of_group_type(group_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `group_hash` (Hash): The JOAAT hash of the group the weapon(s) belong to.
|
||||
|
||||
- **Returns:**
|
||||
- `weapons_of_group_type`: table<int, String>: a list of all weapons that match the group hash passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
local pistols = weapons.get_all_weapons_of_group_type(joaat('GROUP_PISTOL'))
|
||||
@ -46,14 +50,19 @@ for i = 1, #pistols do
|
||||
end
|
||||
```
|
||||
|
||||
### `get_all_weapons_of_group_type(group_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `group_name` (String): The group the weapon(s) belong to. Can be in either GROUP_ format or not. Parameter is case-insensitive.
|
||||
- `group_hash` (Hash): The JOAAT hash of the group the weapon(s) belong to.
|
||||
|
||||
- **Returns:**
|
||||
- `weapons_of_group_type`: table<int, String>: a list of all weapons that match the group hash passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
weapons_of_group_type = weapons.get_all_weapons_of_group_type(group_hash)
|
||||
```
|
||||
|
||||
### `get_all_weapons_of_group_type(group_name)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
local pistols = weapons.get_all_weapons_of_group_type('GROUP_PISTOL')
|
||||
@ -67,13 +76,18 @@ for i = 1, #pistols do
|
||||
end
|
||||
```
|
||||
|
||||
### `get_all_weapon_components(weapon_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_hash` (Hash): The JOAAT hash of the weapon the component(s) belong to.
|
||||
- `group_name` (String): The group the weapon(s) belong to. Can be in either GROUP_ format or not. Parameter is case-insensitive.
|
||||
|
||||
- **Returns:**
|
||||
- `weapon_components`: table<int, String>: a list of all components that match the weapon passed in. The list can contain anything from 0 to n elements.
|
||||
- `weapons_of_group_type`: table<int, String>: a list of all weapons that match the group hash passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
weapons_of_group_type = weapons.get_all_weapons_of_group_type(group_name)
|
||||
```
|
||||
|
||||
### `get_all_weapon_components(weapon_hash)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
@ -83,14 +97,19 @@ for i = 1, #pistol_attachments do
|
||||
end
|
||||
```
|
||||
|
||||
### `get_all_weapon_components(weapon_name)`
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_name` (String): The weapon the component(s) belong to.
|
||||
- `weapon_hash` (Hash): The JOAAT hash of the weapon the component(s) belong to.
|
||||
|
||||
- **Returns:**
|
||||
- `weapon_components`: table<int, String>: a list of all components that match the weapon passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
weapon_components = weapons.get_all_weapon_components(weapon_hash)
|
||||
```
|
||||
|
||||
### `get_all_weapon_components(weapon_name)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
local pistol_attachments = weapons.get_all_weapon_components('WEAPON_PISTOL')
|
||||
@ -99,54 +118,87 @@ for i = 1, #pistol_attachments do
|
||||
end
|
||||
```
|
||||
|
||||
### `get_weapon_component_display_name(weapon_component_hash)`
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_component_hash` (Hash): JOAAT hash of the weapon component.
|
||||
- `weapon_name` (String): The weapon the component(s) belong to.
|
||||
|
||||
- **Returns:**
|
||||
- `component_display_name`: String: the in-game display string. If the component is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
- `weapon_components`: table<int, String>: a list of all components that match the weapon passed in. The list can contain anything from 0 to n elements.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
weapon_components = weapons.get_all_weapon_components(weapon_name)
|
||||
```
|
||||
|
||||
### `get_weapon_component_display_name(weapon_component_hash)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_name(joaat('COMPONENT_PISTOL_CLIP_01')))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_component_hash` (Hash): JOAAT hash of the weapon component.
|
||||
|
||||
- **Returns:**
|
||||
- `component_display_name`: String: the in-game display string. If the component is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
**Example Usage:**
|
||||
```lua
|
||||
component_display_name = weapons.get_weapon_component_display_name(weapon_component_hash)
|
||||
```
|
||||
|
||||
### `get_weapon_component_display_name(weapon_component)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_name('COMPONENT_PISTOL_CLIP_01'))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_component` (String): The weapon component.
|
||||
|
||||
- **Returns:**
|
||||
- `component_display_name`: String: the in-game display string. If the component is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_name('COMPONENT_PISTOL_CLIP_01'))
|
||||
component_display_name = weapons.get_weapon_component_display_name(weapon_component)
|
||||
```
|
||||
|
||||
### `get_weapon_component_display_desc(weapon_component_hash)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_desc(joaat('COMPONENT_PISTOL_CLIP_01')))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_component_hash` (Hash): JOAAT hash of the weapon component.
|
||||
|
||||
- **Returns:**
|
||||
- `component_display_desc`: String: the in-game display string. If the component is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_desc(joaat('COMPONENT_PISTOL_CLIP_01')))
|
||||
component_display_desc = weapons.get_weapon_component_display_desc(weapon_component_hash)
|
||||
```
|
||||
|
||||
### `get_weapon_component_display_desc(weapon_component)`
|
||||
|
||||
- **Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_desc('COMPONENT_PISTOL_CLIP_01'))
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `weapon_component` (String): The weapon component.
|
||||
|
||||
- **Returns:**
|
||||
- `component_display_desc`: String: the in-game display string. If the component is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
|
||||
|
||||
- **Example Usage:**
|
||||
**Example Usage:**
|
||||
```lua
|
||||
log.info(weapons.get_weapon_component_display_desc('COMPONENT_PISTOL_CLIP_01'))
|
||||
```
|
||||
component_display_desc = weapons.get_weapon_component_display_desc(weapon_component)
|
||||
```
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user