Inherits from NSObject
Declared in KKLua.h

Overview

Static class containing various Lua related helper methods.

Tasks

Other Methods

Execute Scripts

Error Handling

Class Methods

doFile:

Runs the Lua script file. File is a filename with or without path to the file, and with extension. Returns YES if the execution was successful and NO if it failed. Note that this is different from Lua, where a return value of 0 indicates success and 1 or higher indicates an error. But YES == success is more natural for Objective-C programmers.

+ (BOOL)doFile:(NSString *)aFile

Parameters

aFile

The full path to a Lua script file.

Return Value

YES if the file was found and the script was executed without errors.

Declared In

KKLua.h

doString:

Runs the Lua code passed in as string. Returns YES if the execution was successful and NO if it failed. Note that this is different from Lua, where a return value of 0 indicates success and 1 or higher indicates an error. But YES == success is more natural for Objective-C programmers.

+ (BOOL)doString:(NSString *)aString

Parameters

aString

A Lua script as string.

Return Value

YES if the string was executed without errors.

Declared In

KKLua.h

logLuaError

Logs the most recent Lua error by getting the error message string from the stack index -1 and displaying it.

+ (void)logLuaError

Declared In

KKLua.h

logLuaErrorWithMessage:

Logs a Lua error with a custom message.

+ (void)logLuaErrorWithMessage:(NSString *)aMessage

Parameters

aMessage

The custom message to append to the log.

Declared In

KKLua.h

luaState

The current lua state. Needed only for custom Lua code.

+ (lua_State *)luaState

Return Value

The current lua state. Needed only for custom Lua code.

Declared In

KKLua.h

setup

One-time setup of Lua. Automatically called by the Kobold Kit framework.

+ (void)setup

Declared In

KKLua.h