CoronaLuaIOS.h

Type C header
Revision 2017.3060
Keywords iOS, Corona Enterprise, CoronaLuaIOS.h
See also Corona Enterprise — iOS
Corona C Functions

Overview

CoronaLuaIOS.h contains additional APIs to help you interact between Lua and Obj-C. These functions complement the Corona C Functions.

As with CoronaLua.h, all C functions are prefixed with CoronaLua.

Functions

CoronaLuaCreateDictionary()

NSDictionary* CoronaLuaCreateDictionary( lua_State *L, int index ). Creates and returns a NSDictionary corresponding to the table at index. This NSDictionary contains the Obj-C equivalent of Lua types. The following indicates how Lua values in the table are converted to Obj-C values:

CoronaLuaPushImage()

int CoronaLuaPushImage( lua_State *L, UIImage *image ). Creates a display object using image and pushes it to the top of the stack. If successful, returns 1 indicating that the object was pushed onto the Lua stack; otherwise returns 0.

CoronaLuaPushValue()

int CoronaLuaPushValue( lua_State *L, id value ). Pushes a Lua value onto the top of the stack corresponding to the Obj-C object value. Returns 1 if a corresponding Lua value can be created; 0 otherwise. The following Obj-C values can be converted:

  • NSNumber → Lua boolean or Lua number (if not BOOL, conversion is assumed to be double)
  • NSString → Lua string
  • NSArray → Lua table (1-based, sequential, numerical indices)
  • NSDictionary → Lua table