Created
July 4, 2012 14:42
-
-
Save german/3047712 to your computer and use it in GitHub Desktop.
minimal mruby program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include “mruby.h” | |
#include “mruby/proc.h” | |
#include <stdio.h> | |
void _error(const char* s){ | |
printf("ERROR: %s\n", s); | |
exit(1); | |
} | |
int main() { | |
mrb_state *mrb; | |
int n; | |
mrb = mrb_open(); | |
// you could also use mrb_compile_file(mrb, file_descriptor) in order to compile certain .rb files | |
n = mrb_compile_string(mrb, "d = lambda { puts 'Hello, World!' }; d[]"); | |
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_nil_value()); | |
mrb_close(mrb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment