/script_binding/lua/lua_ftk_file.c
http://ftk.googlecode.com/ · C · 59 lines · 46 code · 12 blank · 1 comment · 1 complexity · 22d596f1acd3a822d80636a8ee6b6aef MD5 · raw file
- /*This file is generated by luagen.*/
- #include "lua_ftk_file.h"
- #include "lua_ftk_callbacks.h"
- static void tolua_reg_types (lua_State* L)
- {
- tolua_usertype(L, "FtkFile");
- }
- static int lua_ftk_file_get_info(lua_State* L)
- {
- tolua_Error err = {0};
- Ret retv;
- const char* file_name;
- FtkFileInfo* info;
- int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isusertype(L, 2, "FtkFileInfo", 0, &err);
- return_val_if_fail(param_ok, 0);
- file_name = tolua_tostring(L, 1, 0);
- info = tolua_tousertype(L, 2, 0);
- retv = ftk_file_get_info(file_name, info);
- tolua_pushnumber(L, (lua_Number)retv);
- return 1;
- }
- static int lua_ftk_file_get_mime_type(lua_State* L)
- {
- tolua_Error err = {0};
- const char* retv;
- const char* file_name;
- int param_ok = tolua_isstring(L, 1, 0, &err);
- return_val_if_fail(param_ok, 0);
- file_name = tolua_tostring(L, 1, 0);
- retv = ftk_file_get_mime_type(file_name);
- tolua_pushstring(L, (const char*)retv);
- return 1;
- }
- int tolua_ftk_file_init(lua_State* L)
- {
- tolua_open(L);
- tolua_reg_types(L);
- tolua_module(L, NULL, 0);
- tolua_beginmodule(L, NULL);
- tolua_cclass(L,"FtkFile", "FtkFile", "", NULL);
- tolua_beginmodule(L, "FtkFile");
- tolua_function(L, "GetInfo", lua_ftk_file_get_info);
- tolua_function(L, "GetMimeType", lua_ftk_file_get_mime_type);
- tolua_endmodule(L);
- tolua_endmodule(L);
- return 1;
- }