Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import luad.all;
- import std.stdio;
- class Printer
- {
- private:
- string message;
- public:
- this(string message)
- {
- this.message = message;
- }
- void print()
- {
- writeln(message);
- }
- }
- void main()
- {
- auto lua = new LuaState;
- lua.openLibs();
- lua.globals()["Printer"] = (string msg){
- return new Printer(msg);
- };
- lua.doString(`
- local printer = Printer("test")
- print(printer)
- printer:print()
- `);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement