Are you sure there's no error in your code?
I just checked this solution and it seems to work, the code prints the table it just created:
#include <lua.hpp>
#include <stdio.h>
static int fun(lua_State * L)
{
int i;
lua_newtable(L);
for(i = 0; i < 10; i++ )
{
lua_pushstring(L, "A");
lua_rawseti(L,-2,i);
}
lua_setglobal(L, "t");
return 1;
}
int main()
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
fun(L);
if (luaL_dostring(L, "for k,v in ipairs(t) do print(k,v); end;\n"))
printf("%s\n",luaL_checkstring(L, -1));
lua_close(L);
}