LoriotPro Extended Edition LUA scripting documentation

TOC
LUA TOC


LUA library development project

The Extended Edition provides a working example of a Visual Studio project in .net2003 that can help your to create your own set of LUA library

lua_wizard.dll

// Lua_wizard.cpp : Defines the entry point for the DLL application.

//

 

#define WIN32_LEAN_AND_MEAN       // Exclude rarely-used stuff from Windows headers

#include <windows.h>

 

extern "C" {

  #include "../lib/lua.h"

  #include "../lib/lualib.h"

  #include "../lib/lauxlib.h"

  #include "../lib/compat-5.1.h"

}

 

#define LUA_WIZARD_LIBNAME "lpwz"

 

 

  /* Pop-up a Windows message box with your choice of message and caption */

   int lua_MsgBox(lua_State* L)

  {

    const char* message = luaL_checkstring(L, 1);

    const char* caption = luaL_optstring(L, 2, "");

    int result = MessageBox(NULL, message, caption, MB_OK);

    lua_pushnumber(L, result);

    return 1;

  }

 

static luaL_reg wizard_func[] = {

    {"MsgBox",      lua_MsgBox},

    {NULL,        NULL}

};

 

   int libinit(lua_State* L)

  {

    /* export functions (and leave namespace table on top of stack) */

   //luaL_openlib(L, "lpwiz", func, 0);

   //lua_register(L, "MsgBox",  lua_MsgBox);

   luaL_openlib(L, LUA_WIZARD_LIBNAME, wizard_func, 0);

   return 0;

  }

lua_wizard.def

LIBRARY      "Lua_WIZARD_LIB"

DESCRIPTION  'LoriotPro LUA 5.0.2 Plug-in MFC Windows Dynamic Link Library'

 

EXPORTS

 libinit

Compilation options

 

 

 

 



 

 




www.loriotpro.com