[Quest API] Add commify to Perl/Lua. (#2099)

- Add quest::commify(number) to Perl.
- Add eq.commify(number) to Lua.
This commit is contained in:
Kinglykrab
2022-05-03 19:44:22 -04:00
committed by GitHub
parent c4f05c3864
commit 9b075c28b6
5 changed files with 45 additions and 23 deletions
+17
View File
@@ -8175,6 +8175,22 @@ XS(XS__getenvironmentaldamagename) {
XSRETURN(1);
}
XS(XS__commify);
XS(XS__commify) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::commify(std::string number)");
dXSTARG;
std::string number = (std::string) SvPV_nolen(ST(0));
std::string commified_number = commify(number);
sv_setpv(TARG, commified_number.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
/*
This is the callback perl will look for to setup the
quest package's XSUBs
@@ -8268,6 +8284,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "clear_zone_flag"), XS__clear_zone_flag, file);
newXS(strcpy(buf, "clearspawntimers"), XS__clearspawntimers, file);
newXS(strcpy(buf, "collectitems"), XS__collectitems, file);
newXS(strcpy(buf, "commify"), XS__commify, file);
newXS(strcpy(buf, "completedtasksinset"), XS__completedtasksinset, file);
newXS(strcpy(buf, "countitem"), XS__countitem, file);
newXS(strcpy(buf, "countspawnednpcs"), XS__countspawnednpcs, file);