]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
stof builtin #9
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 1 Dec 2012 14:54:13 +0000 (15:54 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 1 Dec 2012 14:54:13 +0000 (15:54 +0100)
exec.c

diff --git a/exec.c b/exec.c
index bd279c6550ac7a91b1a9aabe575b0d2d2e132ecb..cc05630f0ed2eca6694ea00444b9f89ef884ded3 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -692,6 +692,18 @@ static int qc_ftos(qc_program *prog)
     return 0;
 }
 
+static int qc_stof(qc_program *prog)
+{
+    char buffer[512];
+    qcany *str;
+    qcany num;
+    CheckArgs(1);
+    str = GetArg(0);
+    num._float = strtof(prog_getstring(prog, str->string), NULL);
+    Return(num);
+    return 0;
+}
+
 static int qc_vtos(qc_program *prog)
 {
     char buffer[512];
@@ -757,7 +769,8 @@ static prog_builtin qc_builtins[] = {
     &qc_vtos,  /*   5   */
     &qc_error, /*   6   */
     &qc_vlen,  /*   7   */
-    &qc_etos   /*   8   */
+    &qc_etos,  /*   8   */
+    &qc_stof   /*   9   */
 };
 static size_t qc_builtins_count = sizeof(qc_builtins) / sizeof(qc_builtins[0]);