Files
LuaCangjia_api/lib/test1.c
2026-03-18 16:20:46 +08:00

32 lines
556 B
C

#include "lua_cj_api.h"
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
int hello()
{
printf("hellow\n");
return 0;
}
int main()
{
redirectfuncs re;
re.io_input = &hello;
re.io_output = &hello;
void *lua_run = init_lua_runner("path",NULL,hello,hello);
if(lua_run == NULL)
{
printf("%d",errno);
}
if(run(lua_run,"test.lua","path")==-1)
printf("%d",errno);
lua_runner *runner = (lua_runner*)lua_run;
printf("%s",runner->result);
cleanup(lua_run);
free_lua(lua_run);
}