summaryrefslogtreecommitdiff
path: root/iup/srclua3/iuplua_im.c
blob: 2104e0dc1e0d4b3986d731ce3c8fb2859f866d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/** \file
 * \brief IULUA core - Bindig of iup to Lua 3.
 *
 * See Copyright Notice in "iup.h"
 */
 
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "iup.h"
#include "iupim.h"

#include <lua.h>
#include <lauxlib.h>

#include "iuplua.h"
#include "iupluaim.h"
#include "il.h"

static void SaveImage(void)
{
  Ihandle* image = iuplua_checkihandle(1);
  char *filename = luaL_check_string(2);
  char *format = luaL_check_string(3);
  lua_pushnumber(IupSaveImage(image, filename, format));
}

static void LoadImage(void)
{
  char *filename = luaL_check_string(1);
  iuplua_pushihandle(IupLoadImage(filename));
}

void iupimlua_open(void)
{
  iuplua_register("IupLoadImage", LoadImage);
  iuplua_register("IupSaveImage", SaveImage);
}