diff options
| author | realtradam <[email protected]> | 2023-05-26 01:01:44 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2023-05-26 01:01:44 -0400 |
| commit | 85f3e9ed33b3e3cab7e011bae3b1ac99fb4520a7 (patch) | |
| tree | 5f6819bcd93a10c66eb3daf0bd90ec88f194bbb2 /mrb_gems/basic_example/src | |
| parent | 0e689b72d7fc7afa64508a99948527009712d189 (diff) | |
| download | mruby-playground-85f3e9ed33b3e3cab7e011bae3b1ac99fb4520a7.tar.gz mruby-playground-85f3e9ed33b3e3cab7e011bae3b1ac99fb4520a7.zip | |
some progress
Diffstat (limited to 'mrb_gems/basic_example/src')
| -rw-r--r-- | mrb_gems/basic_example/src/basic_example.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/mrb_gems/basic_example/src/basic_example.c b/mrb_gems/basic_example/src/basic_example.c index 908acd2..f039f80 100644 --- a/mrb_gems/basic_example/src/basic_example.c +++ b/mrb_gems/basic_example/src/basic_example.c @@ -1,30 +1,12 @@ #include <mruby.h> #include <stdio.h> - -// defining the function to be later bound to a ruby method static mrb_value -hello_world(mrb_state *mrb, mrb_value self) -{ - printf("Hello World\n"); - - return mrb_nil_value(); // return null +felbind_say_hello(mrb_state *mrb, mrb_value self){ +printf("Hello World\n"); +return mrb_nil_value(); } - -// gem initializer -void -mrb_basic_example_gem_init(mrb_state* mrb) { - struct RClass *basic_example_class = mrb_define_module(mrb, "BasicExample"); - mrb_define_class_method( - mrb, // Mruby VM state - basic_example_class, // Class we bind method to - "say_hello", // Name of method - hello_world, // Function we are binding as a method - MRB_ARGS_NONE() // How many arguments are optional/required - ); -} - -// gem finalizer -void -mrb_basic_example_gem_final(mrb_state* mrb) { - +void mrb_basic_example_gem_init(mrb_state* mrb) { +struct RClass *BasicExample_class = mrb_define_module(mrb, "BasicExample"); +mrb_define_class_method(mrb, BasicExample_class, "say_hello", felbind_say_hello, MRB_ARGS_NONE()); } +void mrb_basic_example_gem_final(mrb_state* mrb) {} |
