File Scripting.c

FileList > engine > src > scripting > Scripting.c

Go to the source code of this file

  • #include "Scripting.h"
  • #include "lua.h"
  • #include <lualib.h>
  • #include <lauxlib.h>
  • #include <stdlib.h>
  • #include <stdio.h>
  • #include <string.h>
  • #include "AssertLib.h"
  • #include "XMLUIGameLayer.h"
  • #include "RootWidget.h"
  • #include "GameFrameworkEvent.h"
  • #include "GameFramework.h"
  • #include "DataNode.h"
  • #include "main.h"
  • #include "Game2DLayer.h"
  • #include "Log.h"
  • #include "Camera2D.h"

Classes

Type Name
struct LuaListenerUserData

Public Static Attributes

Type Name
lua_State * gL = NULL

Public Functions

Type Name
void Sc_AddLightUserDataValueToTable (int regIndex, const char * userDataKey, void * userDataValue)
bool Sc_Bool ()
void Sc_CallFuncInRegTableEntry (int regIndex, struct ScriptCallArgument * pArgs, int numArgs, int numReturnVals, int selfRegIndex)
void Sc_CallFuncInRegTableEntryTable (int regIndex, const char * funcName, struct ScriptCallArgument * pArgs, int numArgs, int numReturnVals)
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_DeInitScripting ()
void Sc_DeleteTableInReg (int index)
delete a table stored in the lua registry
void Sc_DumpStack ()
float Sc_Float ()
bool Sc_FunctionPresentInTable (int regIndex, const char * funcName)
void Sc_InitScripting ()
int Sc_Int ()
bool Sc_IsBool ()
bool Sc_IsFunction ()
bool Sc_IsInteger ()
bool Sc_IsNil ()
bool Sc_IsNumber ()
bool Sc_IsString ()
bool Sc_IsTable ()
void Sc_NewTableOnStack (int arrayElementHint, int nonArrayElementHint)
bool Sc_OpenFile (const char * path)
void Sc_Pop ()
void Sc_PushInt (int i)
int Sc_RefTable ()
void Sc_RegisterCFunction (const char * name, int(*)(lua_State *) fn)
void Sc_ResetStack ()
void Sc_SetFloatAtTableKey (const char * key, float val)
void Sc_SetIntAtTableIndex (int index, int value)
void Sc_SetIntAtTableKey (const char * key, int val)
void Sc_SetPointerAtTableKey (const char * key, void * ptr)
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_StackTopStrCopy (char * pOutString)
size_t Sc_StackTopStringLen ()
bool Sc_StringCmp (const char * cmpTo)
void Sc_TableGet (const char * key)
void Sc_TableGetIndex (int index)
int Sc_TableLen ()
int Sc_Type ()
void Sc_UnRefTable (int ref)

Public Static Functions

Type Name
const char * GetTypeOnTopOfStack ()
int L_CenterCameraAt (lua_State * L)
int L_FireGameFrameworkEvent (lua_State * L)
int L_FreeButtonBinding (lua_State * L)
int L_GetButtonBinding (lua_State * L)
int L_GetButtonPress (lua_State * L)
int L_GetGamelayerZoom (lua_State * L)
int L_OnPropertyChanged (lua_State * L)
int L_PopGameFrameworkLayer (lua_State * L)
int L_SetGamelayerZoom (lua_State * L)
int L_SubscribeToGameFrameworkEvent (lua_State * L)
int L_UnSubscribeToGameFrameworkEvent (lua_State * L)
void LuaListenerFn (void * pUserData, void * pEventData)
void OnPropertyChangedInternal (XMLUIData * pUIData, HWidget hWidget, const char * pChangedPropName)
void PushFunctionCallArgsOntoStack (struct ScriptCallArgument * pArgs, int numArgs)

Macros

Type Name
define GAME_LUA_MINOR_VERSION 1

Public Static Attributes Documentation

variable gL

lua_State* gL;

Public Functions Documentation

function Sc_AddLightUserDataValueToTable

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

function Sc_Bool

bool Sc_Bool () 

function Sc_CallFuncInRegTableEntry

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

function Sc_CallFuncInRegTableEntryTable

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

function Sc_CallGlobalFuncReturningTableAndStoreResultInReg

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

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

Parameters:

  • funcName
  • pArgs
  • numArgs

Returns:

key to the table returned, stored in the registry table. 0 if failed


function Sc_DeInitScripting

void Sc_DeInitScripting () 

function Sc_DeleteTableInReg

delete a table stored in the lua registry

void Sc_DeleteTableInReg (
    int index
) 

Parameters:

  • index

function Sc_DumpStack

void Sc_DumpStack () 

function Sc_Float

float Sc_Float () 

function Sc_FunctionPresentInTable

bool Sc_FunctionPresentInTable (
    int regIndex,
    const char * funcName
) 

function Sc_InitScripting

void Sc_InitScripting () 

function Sc_Int

int Sc_Int () 

function Sc_IsBool

bool Sc_IsBool () 

function Sc_IsFunction

bool Sc_IsFunction () 

function Sc_IsInteger

bool Sc_IsInteger () 

function Sc_IsNil

bool Sc_IsNil () 

function Sc_IsNumber

bool Sc_IsNumber () 

function Sc_IsString

bool Sc_IsString () 

function Sc_IsTable

bool Sc_IsTable () 

function Sc_NewTableOnStack

void Sc_NewTableOnStack (
    int arrayElementHint,
    int nonArrayElementHint
) 

function Sc_OpenFile

bool Sc_OpenFile (
    const char * path
) 

function Sc_Pop

void Sc_Pop () 

function Sc_PushInt

void Sc_PushInt (
    int i
) 

function Sc_RefTable

int Sc_RefTable () 

function Sc_RegisterCFunction

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

function Sc_ResetStack

void Sc_ResetStack () 

function Sc_SetFloatAtTableKey

void Sc_SetFloatAtTableKey (
    const char * key,
    float val
) 

function Sc_SetIntAtTableIndex

void Sc_SetIntAtTableIndex (
    int index,
    int value
) 

function Sc_SetIntAtTableKey

void Sc_SetIntAtTableKey (
    const char * key,
    int val
) 

function Sc_SetPointerAtTableKey

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

function 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_SetTable () 

function Sc_StackTopStrCopy

void Sc_StackTopStrCopy (
    char * pOutString
) 

function Sc_StackTopStringLen

size_t Sc_StackTopStringLen () 

function Sc_StringCmp

bool Sc_StringCmp (
    const char * cmpTo
) 

function Sc_TableGet

void Sc_TableGet (
    const char * key
) 

function Sc_TableGetIndex

void Sc_TableGetIndex (
    int index
) 

function Sc_TableLen

int Sc_TableLen () 

function Sc_Type

int Sc_Type () 

function Sc_UnRefTable

void Sc_UnRefTable (
    int ref
) 

Public Static Functions Documentation

function GetTypeOnTopOfStack

static const char * GetTypeOnTopOfStack () 

function L_CenterCameraAt

static int L_CenterCameraAt (
    lua_State * L
) 

function L_FireGameFrameworkEvent

static int L_FireGameFrameworkEvent (
    lua_State * L
) 

function L_FreeButtonBinding

static int L_FreeButtonBinding (
    lua_State * L
) 

function L_GetButtonBinding

static int L_GetButtonBinding (
    lua_State * L
) 

function L_GetButtonPress

static int L_GetButtonPress (
    lua_State * L
) 

function L_GetGamelayerZoom

static int L_GetGamelayerZoom (
    lua_State * L
) 

function L_OnPropertyChanged

static int L_OnPropertyChanged (
    lua_State * L
) 

function L_PopGameFrameworkLayer

static int L_PopGameFrameworkLayer (
    lua_State * L
) 

function L_SetGamelayerZoom

static int L_SetGamelayerZoom (
    lua_State * L
) 

function L_SubscribeToGameFrameworkEvent

static int L_SubscribeToGameFrameworkEvent (
    lua_State * L
) 

function L_UnSubscribeToGameFrameworkEvent

static int L_UnSubscribeToGameFrameworkEvent (
    lua_State * L
) 

function LuaListenerFn

static void LuaListenerFn (
    void * pUserData,
    void * pEventData
) 

function OnPropertyChangedInternal

static void OnPropertyChangedInternal (
    XMLUIData * pUIData,
    HWidget hWidget,
    const char * pChangedPropName
) 

function PushFunctionCallArgsOntoStack

static void PushFunctionCallArgsOntoStack (
    struct ScriptCallArgument * pArgs,
    int numArgs
) 

Macro Definition Documentation

define GAME_LUA_MINOR_VERSION

#define GAME_LUA_MINOR_VERSION `1`


The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/src/scripting/Scripting.c