bitburner-src/markdown/bitburner.bladeburner.getstamina.md

46 lines
844 B
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Bladeburner](./bitburner.bladeburner.md) &gt; [getStamina](./bitburner.bladeburner.getstamina.md)
## Bladeburner.getStamina() method
2021-11-03 05:27:21 +01:00
Get bladeburner stamina.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
getStamina(): [number, number];
```
<b>Returns:</b>
\[number, number\]
Array containing current stamina and max stamina.
## Remarks
2021-11-03 05:27:21 +01:00
RAM cost: 4 GB Returns an array with two elements: \* \[Current stamina, Max stamina\]
2021-10-30 18:34:14 +02:00
2022-01-08 19:25:06 +01:00
## Example 1
2021-10-30 18:34:14 +02:00
2021-10-30 21:46:34 +02:00
```ts
2022-01-08 19:25:06 +01:00
// NS1:
2021-10-30 18:34:14 +02:00
function getStaminaPercentage() {
2022-01-08 19:25:06 +01:00
var res = bladeburner.getStamina();
2021-10-30 18:34:14 +02:00
return res[0] / res[1];
}
```
2022-01-08 19:25:06 +01:00
## Example 2
```ts
// NS2:
function getStaminaPercentage() {
const [current, max] = ns.bladeburner.getStamina();
return current / max;
}
```