In process of adding luaconsole.cpp
This commit is contained in:
50
luprex/cpp/globaldb.hpp
Normal file
50
luprex/cpp/globaldb.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GLOBALDB
|
||||
//
|
||||
// The master world model is allowed to maintain global data structures.
|
||||
//
|
||||
// Unfortunately, any attempt to put a global data structure into the global
|
||||
// environment will fail, because the global environment periodically gets wiped
|
||||
// clean by the "source rebuild" procedure (see module 'source').
|
||||
//
|
||||
// This module creates a safe space where you can put global data structures
|
||||
// that won't get wiped out.
|
||||
//
|
||||
// THE GLOBAL OPERATOR
|
||||
//
|
||||
// This module adds a new function to lua: "global". Global takes a global data
|
||||
// structure name (a string) and returns a table for that global data structure.
|
||||
// You can put anything you want into the table.
|
||||
//
|
||||
// Since you're only allowed to use global data structures in the master world
|
||||
// model, any attempt to call "global" in a synchronous world model will
|
||||
// result in a 'donotpredict' error.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLOBALDB_HPP
|
||||
#define GLOBALDB_HPP
|
||||
|
||||
#include "luastack.hpp"
|
||||
|
||||
// globaldb_enable
|
||||
//
|
||||
// Enable the use of the global DB. This is meant to be invoked in
|
||||
// the master world model only. In other world models, you should simply
|
||||
// not call this function.
|
||||
//
|
||||
int globaldb_enable(lua_State *L);
|
||||
|
||||
// The lua 'global' operator.
|
||||
//
|
||||
// Given a global name, returns a table for that global.
|
||||
//
|
||||
// If you haven't enabled the global DB using globaldb_enable, this
|
||||
// raises a donotpredict error.
|
||||
//
|
||||
int globaldb_global(lua_State *L);
|
||||
|
||||
#endif // GLOBALDB_HPP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user