mirror of
https://gitcode.com/JianFeeeee/LuaCangjia_api.git
synced 2026-10-03 16:03:59 +00:00
初始化仓库
This commit is contained in:
32
lib/test1.c
Normal file
32
lib/test1.c
Normal file
@ -0,0 +1,32 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user