lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Luiz

I have now built my 16 bit version of Lua 4.1 alpha, using BC++ 5.02 - 
and converted my C code from 3.2 style code to 4.1 alpha style.

Changes:

Line 66 of lopcodes.c to
const lu_byte luaP_opmodes[NUM_OPCODES] = {

line 216 of lopcodes.h to
extern const lu_byte luaP_opmodes[NUM_OPCODES];

line 43 of ltm.h to
#define HAS_TM_GETGLOBAL(L,t)  ((1<<(t)) & ((1<<LUA_TUSERDATA) | \

line 47 of ltm.h to
#define HAS_TM_SETGLOBAL(L,t)  ((1<<(t)) & ((1<<LUA_TUSERDATA) | \


I know that these are all reckoned to be changes where the original is 
valid, but BC++ 5.02 is no longer young!

Plus, as I am building a DLL version, I change

#ifndef LUA_API
 #define LUA_API       extern
#endif

to

#ifndef LUA_API
 #if defined (__DLL__)
  #define LUA_API __declspec(dllexport)
 #else
  #define LUA_API
 #endif
#endif

and similarly for the Library "extern" defines. This what the LUA_API 
stuff was intended for - thanks, it works very well.

As I am building a C++ program, but lua is compiled as C, my standard 
set of includes in my own code is

namespace lua
{
   extern "C"
   {
      #include "lua.h"
      #include "luadebug.h"
      #include "lualib.h"
      #include "lauxlib.h"
   }
}

which means that I either have to add 

using namespace lua

to procedures that call lua, or

lua:: on the front of individual references.

As far as I have tested it in my application, it works correctly, but I 
am still really experimenting with it. I am still hoping for a 
thread/coroutine library that I can use, mainly to allow some scripting 
of asynchronous serial comms activities in a way that a (reasonably 
competent) end user could understand.

Thanks again for Lua, and for changing it to make my life easy.
Mike Goodey