Skip to content

Add StringToInt64() and Int64ToString() natives#1511

Merged
asherkin merged 4 commits intoalliedmodders:masterfrom
Wend4r:patch-3
Jun 28, 2021
Merged

Add StringToInt64() and Int64ToString() natives#1511
asherkin merged 4 commits intoalliedmodders:masterfrom
Wend4r:patch-3

Conversation

@Wend4r
Copy link
Contributor

@Wend4r Wend4r commented Jun 25, 2021

No description provided.

@Wend4r
Copy link
Contributor Author

Wend4r commented Jun 25, 2021

@asherkin
Copy link
Member

Nice! This is a good interim solution and something I've been intending to add a format specifier for doing for ages.

Could you add some test cases to the test suite? (Or share a test plugin and test results here.)

@peace-maker
Copy link
Member

BigInt usually stands for some way to store any large number not restricted to 64 bits. Using Int64 might be more descriptive.

@Wend4r Wend4r changed the title Add StringToBigInt() and BigIntToString() natives Add StringToInt64() and Int64ToString() natives Jun 26, 2021
@Wend4r Wend4r requested a review from dvander June 26, 2021 09:03
@asherkin
Copy link
Member

I wonder if Int64ToString should be a format specifier <instead / as well>? I imagine most of the use cases are going to be embedding one in a larger string such as a URL or SQL query.

@dvander
Copy link
Member

dvander commented Jun 28, 2021

I'm ambivalent. Using int64 ids as anything other than strings is a bad idea unless there's some mathematical calculation going on. As numbers they are not portable to other languages (eg JavaScript/JSON).

@asherkin asherkin merged commit f603b7a into alliedmodders:master Jun 28, 2021
@Wend4r Wend4r deleted the patch-3 branch June 28, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants