i have this code (zstring.c)
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include <string.h>
static int zst_strlen(lua_State *L)
{
size_t len;
len = strlen(lua_tostring(L, 1));
lua_pushnumber(L, len);
return 1;
}
int luaopen_zstring(lua_State *L)
{
lua_register(L,"zst_strlen", zst_strlen);
return 0;
}
and this is my lua embedded
int main (){
L = luaL_newstate();
luaL_openlibs(L);
luaL_dofile(L, "test.lua");
lua_close(L);
return 0;
}
i do not want compile zstring.c to zstring.so object
i want zstring.c compile into my embedded lua then i can call zstring from test.lua and use it
how to do it?