lua-users home
lua-l archive

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

Put in your test.h

#ifdef __cplusplus
extern "C" {
void my_func(int blah);
#ifdef __cplusplus

And for calling to a globals functions that being loaded from your
scripts use some like this

by example in lua have

function OnInitialUpdate(str)

Call it from C
    if(lua_type(L,-1) == LUA_TFUNCTION)
       lua_pushstring(L,"Function Argument");      //OnInitial update
have 1 argument
       lua_call(L,1,0);   //Call function with 1 argument and not expect
any result
       lua_pop(L,1);   //pop any other type , by example nil if
OnInitialUpdate non exist;

And of course read PIL

Sorry by any errors , and poor english too.