- moved GetCurrentScript call from lua into engine lua code

- moved print_stack from dummy func list
- cleanup braces
This commit is contained in:
Pawel Kolodziejski 2004-10-31 15:34:14 +00:00
parent 661de1a589
commit ce72edc1a7
6 changed files with 12 additions and 9 deletions

View file

@ -83,7 +83,7 @@ Block *Lab::getFileBlock(const char *filename) const {
data[i->second.len] = '\0'; // For valgrind cleanness
data[i->second.len + 1] = '\0';
return new Block(data, i->second.len);
}
}
std::FILE *Lab::openNewStream(const char *filename) const {
file_map_type::const_iterator i = find_filename(filename);

14
lua.cpp
View file

@ -1188,6 +1188,10 @@ static void FreeObjectState() {
//scene.deleteObjectState(object);
}
static void GetCurrentScript() {
current_script();
}
// Stub function for builtin functions not yet implemented
static void stubWarning() {
@ -1410,7 +1414,6 @@ static char *stubFuncs[] = {
"DrawLine",
"pause_scripts",
"unpause_scripts",
"print_stack"
};
// Entries in the system table
@ -1676,7 +1679,8 @@ struct luaL_reg builtins[] = {
{ "SetSpeechMode", SetSpeechMode },
{ "GetTextCharPosition", GetTextCharPosition },
{ "GetDiskFreeSpace", GetDiskFreeSpace },
{ "Is3DHardwareEnabled", Is3DHardwareEnabled }
{ "Is3DHardwareEnabled", Is3DHardwareEnabled },
{ "GetCurrentScript", GetCurrentScript }
};
void register_lua() {
@ -1755,10 +1759,10 @@ int bundle_dofile(const char *filename) {
// d:\grimFandango\Scripts\foo.lua
if (std::strstr(filename, "Scripts\\") == NULL)
warning("Cannot find script %s\n", filename);
return 2;
}
return 2;
}
int result = lua_dobuffer(const_cast<char *>(b->data()), b->len(),
int result = lua_dobuffer(const_cast<char *>(b->data()), b->len(),
const_cast<char *>(filename));
delete b;
return result;

View file

@ -515,7 +515,6 @@ static struct luaL_reg int_funcs[] = {
{"identify_script", identify_script},
{"find_script", find_script},
{"break_here", break_here},
{"GetCurrentScript", GetCurrentScript}
};

View file

@ -172,7 +172,7 @@ void break_here (void) {
L->Tstate = YIELD;
}
void GetCurrentScript (void) {
void current_script (void) {
if (L->curr_task == L->root_task)
lua_pushnil();
else {

View file

@ -12,7 +12,6 @@ void next_script (void);
void identify_script (void);
void find_script (void);
void break_here (void);
void GetCurrentScript (void);
void gc_task (void);

View file

@ -101,6 +101,7 @@ long lua_collectgarbage (long limit);
void lua_runtasks (void);
void current_script (void);
/* =============================================================== */
/* some useful macros/derived functions */