Created
October 11, 2011 15:53
-
-
Save JesseKPhillips/1278488 to your computer and use it in GitHub Desktop.
This will cause the assert on line 184 of functions.d to fire.
This file contains hidden or 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
version(Windows) { | |
pragma(lib, "lua51.lib"); | |
} else | |
pragma(lib, "liblua.a"); | |
import std.stdio; | |
import luad.all; | |
alias string delegate(string) MyFun; | |
void main() { | |
auto lua = new LuaState(); | |
lua.openLibs(); | |
MyFun[string] funs; | |
void makeCall(string name, string str) { | |
funs[name](str); | |
} | |
void addFun(string name, MyFun fun) { | |
funs[name] = fun; | |
} | |
lua["makeCall"] = &makeCall; | |
lua["addFun"] = &addFun; | |
lua.doString(q{ | |
function echo(str) | |
return str | |
end | |
addFun("echo", echo) | |
makeCall("echo", "hello") | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment