mirror of
https://gitcode.com/JianFeeeee/LuaCangjia_api.git
synced 2026-09-19 16:42:48 +00:00
32 lines
556 B
C
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);
|
|
} |