#include <iostream>
#include <lua.hpp>
#include "laf.hpp"
using namespace std;
int main() {
lua_State * L = luaL_newstate();
luaL_openlibs(L);
int a = 5;
laf::push_function(L, [a](int b) { cout << "adding " << a << " to " << b; return a + b; });
lua_setglobal(L, "add_5");
assert(luaL_dostring(L, "return add_5(3)") == 0);
cout << ", the result is " << lua_tonumber(L, -1) << endl;
return 0;
}-
Notifications
You must be signed in to change notification settings - Fork 0
tomstitt/laf
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Automatic lua_cfunction/lua callback generator
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published