Changeset 607 for trunk/core/luascript.c
- Timestamp:
- 11/30/08 10:40:36 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/luascript.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/luascript.c
r606 r607 201 201 } 202 202 203 static int luaCB_get_parameter_data( lua_State* L ) 204 { 205 extern long* FlashParamsTable[]; 206 207 unsigned size; 208 unsigned id = luaL_checknumber( L, 1 ); 209 unsigned val; 210 211 if (id >= get_flash_params_count()) { 212 // return nil 213 return 0; 214 } 215 216 size = FlashParamsTable[id][1]>>16; 217 if (size == 0) { 218 // return nil 219 return 0; 220 } 221 if (size >= 1 && size <= 4) { 222 val = 0; 223 get_parameter_data( id, &val, size ); 224 lua_pushlstring( L, (char *)&val, size ); 225 // for convenience, params that fit in a number are returned in one as a second result 226 lua_pushnumber( L, val ); 227 return 2; 228 } 229 else { 230 char *buf = malloc(size); 231 if(!buf) { 232 luaL_error( L, "malloc failed in luaCB_get_parameter_data" ); 233 } 234 get_parameter_data( id, buf, size ); 235 lua_pushlstring( L, buf, size ); 236 free(buf); 237 return 1; 238 } 239 } 240 241 static int luaCB_get_flash_params_count( lua_State* L ) 242 { 243 lua_pushnumber( L, get_flash_params_count() ); 244 return 1; 245 } 246 203 247 static int luaCB_set_av96_direct( lua_State* L ) 204 248 { … … 383 427 } 384 428 385 #if defined (CAMERA_g7) || defined (CAMERA_sx100is) || defined (CAMERA_g9)429 #if CAM_HAS_JOGDIAL 386 430 static int luaCB_wheel_right( lua_State* L ) 387 431 { … … 857 901 FUNC(get_zoom); 858 902 FUNC(get_exp_count); 903 FUNC(get_flash_params_count); 904 FUNC(get_parameter_data); 859 905 860 906 FUNC(set_av96_direct); … … 884 930 FUNC(is_pressed); 885 931 FUNC(is_key); 886 #if defined (CAMERA_g7) || defined (CAMERA_sx100is)932 #ifdef CAM_HAS_JOGDIAL 887 933 FUNC(wheel_right); 888 934 FUNC(wheel_left);
Note: See TracChangeset
for help on using the changeset viewer.