Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 2.1 KB

lua_glue.h

File metadata and controls

69 lines (51 loc) · 2.1 KB
 
May 12, 2007
May 12, 2007
1
2
3
4
5
6
7
8
/**
* MojoSetup; a portable, flexible installation application.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
Dec 2, 2006
Dec 2, 2006
9
10
11
12
13
14
15
16
17
#ifndef _INCL_LUA_GLUE_H_
#define _INCL_LUA_GLUE_H_
#include "universal.h"
#ifdef __cplusplus
extern "C" {
#endif
May 1, 2007
May 1, 2007
18
19
20
// License text for MojoSetup.
extern const char *GMojoSetupLicense;
Dec 9, 2006
Dec 9, 2006
21
22
23
// License text for Lua.
extern const char *GLuaLicense;
May 1, 2007
May 1, 2007
24
Dec 2, 2006
Dec 2, 2006
25
26
boolean MojoLua_initLua(void);
void MojoLua_deinitLua(void);
Dec 20, 2006
Dec 20, 2006
27
boolean MojoLua_initialized(void);
Dec 2, 2006
Dec 2, 2006
28
Dec 3, 2006
Dec 3, 2006
29
// Run the code in a given Lua file. This is JUST the base filename.
Jan 20, 2008
Jan 20, 2008
30
// We will look for it in GBaseArchive in the (dir) directory, both as
Dec 3, 2006
Dec 3, 2006
31
32
33
34
35
36
// fname.luac and fname.lua. This code chunk will accept no arguments, and
// return no results, but it can change the global state and alter tables,
// etc, so it can have lasting side effects.
// Will return false if the file couldn't be loaded, or true if the chunk
// successfully ran. Will not return if there's a runtime error in the
// chunk, as it will call fatal() instead.
Jan 20, 2008
Jan 20, 2008
37
boolean MojoLua_runFileFromDir(const char *dir, const char *name);
Jan 20, 2008
Jan 20, 2008
38
39
// This is shorthand for MojoLua_runFileFromDir("scripts", fname);
Dec 3, 2006
Dec 3, 2006
40
41
boolean MojoLua_runFile(const char *fname);
May 7, 2007
May 7, 2007
42
43
44
45
46
47
48
49
// Call a function in Lua. This calls MojoSetup.funcname, if it exists and
// is a function. It will not pass any parameters and it will not return
// any values. The call is made unprotected, so if Lua triggers an error,
// this C function will not return. Don't use this if you don't know what
// you're doing.
// Returns true if function was called, false otherwise.
boolean MojoLua_callProcedure(const char *funcname);
Dec 9, 2006
Dec 9, 2006
50
51
52
53
54
55
56
57
// Set a Lua variable in the MojoSetup namespace to a string:
// MojoLua_setString("bob", "name");
// in Lua: print(MojoSetup.name) -- outputs: bob
void MojoLua_setString(const char *str, const char *sym);
// Same as MojoLua_setString, but it creates an ordered table (array).
void MojoLua_setStringArray(int argc, const char **argv, const char *sym);
Dec 3, 2006
Dec 3, 2006
58
59
void MojoLua_collectGarbage(void);
Dec 11, 2006
Dec 11, 2006
60
61
void MojoLua_debugger(void);
Dec 2, 2006
Dec 2, 2006
62
63
64
65
66
67
68
#ifdef __cplusplus
}
#endif
#endif
// end of lua_glue.h ...