Created
February 28, 2013 03:58
-
-
Save gaffo/5054055 to your computer and use it in GitHub Desktop.
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 <iostream> | |
#include <stdio.h> | |
using namespace std; | |
#include <mruby.h> | |
#include <mruby/compile.h> | |
#include <mruby/value.h> | |
class CTest{ | |
public: | |
CTest() {} | |
void do(){ | |
printf("DO!\n"); | |
} | |
}; | |
mrb_value CTest_initialize(mrb_state * mrb, mrb_value self){ | |
CTest * pC = new CTest(); | |
// Store that somehow | |
return ??? | |
} | |
mrb_value CTest_do(mrb_state * mrb, mrb_value self){ | |
CTest * pC = self.??? | |
pC->do(); | |
return self; | |
} | |
int main() { | |
mrb_state *mrb = mrb_open(); | |
struct RClass * handle = mrb_define_class(mrb, "CTest", mrb->object_class); | |
mrb_define_method(mrb, handle, "initialize", CTest_initialize, ARGS_NONE()); | |
mrb_define_method(mrb, handle, "do", CTest_do, ARGS_NONE()); | |
mrb_load_string(mrb, "CTest.new.do"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment