Esempio n. 1
0
void dt_lua_finalize()
{
  dt_lua_lock();
  luaA_close(darktable.lua_state.state);
  lua_close(darktable.lua_state.state);
  darktable.lua_state.state = NULL;
  // never unlock
}
Esempio n. 2
0
void dt_lua_finalize() 
{
  luaA_close(darktable.lua_state.state);
  if(!darktable.lua_state.ending) {
    darktable.lua_state.ending = true;
    lua_close(darktable.lua_state.state);
  }
  darktable.lua_state.state = NULL;
}
Esempio n. 3
0
int main(int argc, char **argv) {
	
  lua_State* L = luaL_newstate();
  
  luaA_open(L);
  luaA_function(L, hello_world, void);
  luaA_function(L, hello_repeat, void, int);
  luaA_function(L, hello_person, void, const char*);
  luaA_function(L, hello_subcount, int, const char*);
  
  lua_register(L, "C", C);
  
  luaL_dostring(L,
    "C('hello_world')\n"
    "C('hello_person', 'Daniel')\n"
    "C('hello_repeat', C('hello_subcount', 'hello hello'))\n"
  );
  
  luaA_close(L);
  lua_close(L);
	
  return 0;
}
Esempio n. 4
0
int main(int argc, char **argv) {
	
  lua_State* L = luaL_newstate();
  luaA_open();
	
  luaA_conversion(pair, luaA_push_pair, luaA_to_pair);
	
  luaA_struct(L, person_details);
  luaA_struct_member(L, person_details, id, int);
  luaA_struct_member(L, person_details, male, char);
  luaA_struct_member(L, person_details, coolness, float);

  pair p = {1, 2};
  person_details my_details = {0, 1, 125212.213};
  
  luaA_push(L, pair, &p);
  printf("Pair: (%s, %s)\n", lua_tostring(L, -2), lua_tostring(L, -1));
  lua_pop(L, 2);
  
  luaA_push(L, person_details, &my_details);
  
  lua_getfield(L, -1, "id");
  printf("Id: %i\n", (int)lua_tointeger(L, -1));
  lua_pop(L, 1);
  
  lua_getfield(L, -1, "male");
  printf("Male: %s\n", (bool)lua_toboolean(L, -1) ? "true" : "false");
  lua_pop(L, 1);
  
  lua_pop(L, 1);
  
  luaA_close();
  lua_close(L);
	
  return 0;
}