Stardew Engine
Loading...
Searching...
No Matches
Scripting.h File Reference
#include <stddef.h>
#include <stdbool.h>
#include "IntTypes.h"
Include dependency graph for Scripting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  LuaListenedEventArgs
 
struct  ScriptCallArgument
 

Macros

#define MAX_SCRIPT_FUNCTION_NAME_SIZE   32
 

Typedefs

typedef struct lua_State lua_State
 only intended for unit testing, and in games linking to the engine
 

Enumerations

enum  ScriptCallArgumentDataType {
  SCA_nil , SCA_boolean , SCA_number , SCA_string ,
  SCA_userdata , SCA_table , SCA_int
}
 

Functions

void Sc_InitScripting ()
 
void Sc_DeInitScripting ()
 
bool Sc_OpenFile (const char *path)
 
int Sc_CallGlobalFuncReturningTableAndStoreResultInReg (const char *funcName, struct ScriptCallArgument *pArgs, int numArgs)
 call a global lua function that returns a table, and store the table in the lua registry (lua_LGetRef)
 
void Sc_CallFuncInRegTableEntryTable (int regIndex, const char *funcName, struct ScriptCallArgument *pArgs, int numArgs, int numReturnVals)
 
void Sc_CallFuncInRegTableEntry (int regIndex, struct ScriptCallArgument *pArgs, int numArgs, int numReturnVals, int selfRegIndex)
 
void Sc_AddLightUserDataValueToTable (int regIndex, const char *userDataKey, void *userDataValue)
 
bool Sc_FunctionPresentInTable (int regIndex, const char *funcName)
 
size_t Sc_StackTopStringLen ()
 
void Sc_StackTopStrCopy (char *pOutString)
 
void Sc_ResetStack ()
 
void Sc_DeleteTableInReg (int index)
 delete a table stored in the lua registry
 
int Sc_Int ()
 
float Sc_Float ()
 
bool Sc_Bool ()
 
bool Sc_IsTable ()
 
bool Sc_IsNil ()
 
bool Sc_IsString ()
 
bool Sc_IsInteger ()
 
bool Sc_IsBool ()
 
bool Sc_IsNumber ()
 
int Sc_Type ()
 
void Sc_Pop ()
 
void Sc_TableGet (const char *key)
 
void Sc_TableGetIndex (int index)
 
int Sc_TableLen ()
 
bool Sc_StringCmp (const char *cmpTo)
 
void Sc_DumpStack ()
 
void Sc_RegisterCFunction (const char *name, int(*fn)(lua_State *))
 
void Sc_NewTableOnStack (int arrayElementHint, int nonArrayElementHint)
 
void Sc_SetIntAtTableIndex (int index, int value)
 
void Sc_SetIntAtTableKey (const char *key, int val)
 
void Sc_SetFloatAtTableKey (const char *key, float val)
 
void Sc_SetPointerAtTableKey (const char *key, void *ptr)
 
int Sc_RefTable ()
 
void Sc_UnRefTable (int ref)
 
void Sc_SetTable ()
 (stack on table) push index onto stack push something to set at the index call this to set the value at the index
 
void Sc_PushInt (int i)
 

Macro Definition Documentation

◆ MAX_SCRIPT_FUNCTION_NAME_SIZE

#define MAX_SCRIPT_FUNCTION_NAME_SIZE   32

Typedef Documentation

◆ lua_State

typedef struct lua_State lua_State

only intended for unit testing, and in games linking to the engine

Enumeration Type Documentation

◆ ScriptCallArgumentDataType

Enumerator
SCA_nil 
SCA_boolean 
SCA_number 
SCA_string 
SCA_userdata 
SCA_table 
SCA_int 

Function Documentation

◆ Sc_AddLightUserDataValueToTable()

void Sc_AddLightUserDataValueToTable ( int  regIndex,
const char *  userDataKey,
void *  userDataValue 
)

◆ Sc_Bool()

bool Sc_Bool ( )

◆ Sc_CallFuncInRegTableEntry()

void Sc_CallFuncInRegTableEntry ( int  regIndex,
struct ScriptCallArgument pArgs,
int  numArgs,
int  numReturnVals,
int  selfRegIndex 
)

◆ Sc_CallFuncInRegTableEntryTable()

void Sc_CallFuncInRegTableEntryTable ( int  regIndex,
const char *  funcName,
struct ScriptCallArgument pArgs,
int  numArgs,
int  numReturnVals 
)

◆ Sc_CallGlobalFuncReturningTableAndStoreResultInReg()

int Sc_CallGlobalFuncReturningTableAndStoreResultInReg ( const char *  funcName,
struct ScriptCallArgument pArgs,
int  numArgs 
)

call a global lua function that returns a table, and store the table in the lua registry (lua_LGetRef)

Parameters
funcName
pArgs
numArgs
Returns
key to the table returned, stored in the registry table. 0 if failed

◆ Sc_DeInitScripting()

void Sc_DeInitScripting ( )

◆ Sc_DeleteTableInReg()

void Sc_DeleteTableInReg ( int  index)

delete a table stored in the lua registry

Parameters
index

◆ Sc_DumpStack()

void Sc_DumpStack ( )

◆ Sc_Float()

float Sc_Float ( )

◆ Sc_FunctionPresentInTable()

bool Sc_FunctionPresentInTable ( int  regIndex,
const char *  funcName 
)

◆ Sc_InitScripting()

void Sc_InitScripting ( )

◆ Sc_Int()

int Sc_Int ( )

◆ Sc_IsBool()

bool Sc_IsBool ( )

◆ Sc_IsInteger()

bool Sc_IsInteger ( )

◆ Sc_IsNil()

bool Sc_IsNil ( )

◆ Sc_IsNumber()

bool Sc_IsNumber ( )

◆ Sc_IsString()

bool Sc_IsString ( )

◆ Sc_IsTable()

bool Sc_IsTable ( )

◆ Sc_NewTableOnStack()

void Sc_NewTableOnStack ( int  arrayElementHint,
int  nonArrayElementHint 
)

◆ Sc_OpenFile()

bool Sc_OpenFile ( const char *  path)

◆ Sc_Pop()

void Sc_Pop ( )

◆ Sc_PushInt()

void Sc_PushInt ( int  i)

◆ Sc_RefTable()

int Sc_RefTable ( )

◆ Sc_RegisterCFunction()

void Sc_RegisterCFunction ( const char *  name,
int(*)(lua_State *)  fn 
)

◆ Sc_ResetStack()

void Sc_ResetStack ( )

◆ Sc_SetFloatAtTableKey()

void Sc_SetFloatAtTableKey ( const char *  key,
float  val 
)

◆ Sc_SetIntAtTableIndex()

void Sc_SetIntAtTableIndex ( int  index,
int  value 
)

◆ Sc_SetIntAtTableKey()

void Sc_SetIntAtTableKey ( const char *  key,
int  val 
)

◆ Sc_SetPointerAtTableKey()

void Sc_SetPointerAtTableKey ( const char *  key,
void *  ptr 
)

◆ Sc_SetTable()

void Sc_SetTable ( )

(stack on table) push index onto stack push something to set at the index call this to set the value at the index

◆ Sc_StackTopStrCopy()

void Sc_StackTopStrCopy ( char *  pOutString)

◆ Sc_StackTopStringLen()

size_t Sc_StackTopStringLen ( )

◆ Sc_StringCmp()

bool Sc_StringCmp ( const char *  cmpTo)

◆ Sc_TableGet()

void Sc_TableGet ( const char *  key)

◆ Sc_TableGetIndex()

void Sc_TableGetIndex ( int  index)

◆ Sc_TableLen()

int Sc_TableLen ( )

◆ Sc_Type()

int Sc_Type ( )

◆ Sc_UnRefTable()

void Sc_UnRefTable ( int  ref)