All pastes #193115 Raw Edit

Anonymous

public c v1 · immutable
·published 2006-10-06 15:57 UTC
rendered paste body
#include <windows.h>#include <lua.h>#include <lauxlib.h>#include <lualib.h>BOOL WINAPI DllMain(HMODULE hModule, DWORD  dwReason, LPVOID lpReserved){	return TRUE;}static INT l_new(lua_State *L){	lua_newtable(L);	lua_getglobal(L, "test");	lua_setmetatable(L, -2);	return 1;}static INT l_deposit(lua_State *L){	MessageBox(NULL, "blah", "Deposit", MB_OK);	return 0;}static INT l_withdraw(lua_State *L){	MessageBox(NULL, "blah", "Withdraw", MB_OK);	return 0;}static const struct luaL_reg testlib [] = {	{"new", l_new},	{"deposit", l_deposit},	{"withdraw", l_withdraw},	{NULL, NULL}  /* sentinel */};INT luaopen_test(lua_State *L){	luaL_register(L, "test", testlib);	lua_setfield(L, -1, "__index");	return 1;}