Changed to using to_string as dispatch instead of print and puts
This commit is contained in:
parent
60b814f687
commit
6ddef8f918
@ -5,19 +5,17 @@
|
||||
#define CHAISCRIPT_PRELUDE_HPP_
|
||||
|
||||
const char *chaiscript_prelude = " \n\
|
||||
def puts(x) : call_exists(range, x) { \n\
|
||||
puts(\"[ \") \n\
|
||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
||||
puts(\"]\") \n\
|
||||
def to_string(x) : call_exists(range, x) { \n\
|
||||
var outstr = \"[\" + x.join(\", \") + \"]\"\n\
|
||||
outstr \n\
|
||||
}\n\
|
||||
def to_string(x) { \n\
|
||||
var outstr = x.internal_to_string()\n\
|
||||
outstr \n\
|
||||
}\n\
|
||||
def puts(x) { \n\
|
||||
print_string(x.to_string()) \n\
|
||||
}; \n\
|
||||
def print(x) : call_exists(range, x) { \n\
|
||||
puts(\"[ \") \n\
|
||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
||||
print(\"]\") \n\
|
||||
} \n\
|
||||
def print(x) { \n\
|
||||
println_string(x.to_string()) \n\
|
||||
}; \n\
|
||||
|
@ -472,8 +472,8 @@ namespace dispatchkit
|
||||
add_oper_assign<std::string>(s);
|
||||
|
||||
|
||||
register_function(s, &to_string<const std::string &>, "to_string");
|
||||
register_function(s, &to_string<bool>, "to_string");
|
||||
register_function(s, &to_string<const std::string &>, "internal_to_string");
|
||||
register_function(s, &to_string<bool>, "internal_to_string");
|
||||
register_function(s, &unknown_assign, "=");
|
||||
|
||||
bootstrap_pod_type<double>(s, "double");
|
||||
|
Loading…
x
Reference in New Issue
Block a user