1 | -- Note: luaState is a pointer to the LuaState instance that created this lua state |
---|
2 | |
---|
3 | -- Redirect debug to print |
---|
4 | debug = print |
---|
5 | |
---|
6 | -- Redirect print to the C++ print function |
---|
7 | print = function(s) |
---|
8 | luaState:luaPrint(s) |
---|
9 | end |
---|
10 | |
---|
11 | -- Create function to log text like COUT, but always prints a line! |
---|
12 | logMessage = function(level, message) |
---|
13 | luaState:luaLog(level, message) |
---|
14 | end |
---|
15 | |
---|
16 | -- Redirect dofile in order to load with the resource manager |
---|
17 | -- Note: The function does not behave exactly like LuaState::doFile because the |
---|
18 | -- default argument here for the group is not "General" but |
---|
19 | -- "NoResourceGroupProvided". This resolves to the resource group used to |
---|
20 | -- do the current file. |
---|
21 | doFile = function(filename, resourceGroup) |
---|
22 | local bSearchOtherPaths = (resourceGroup == nil) or false |
---|
23 | resourceGroup = resourceGroup or "NoResourceGroupProvided" |
---|
24 | luaState:doFile(filename, resourceGroup, bSearchOtherPaths) |
---|
25 | end |
---|
26 | dofile = doFile |
---|
27 | |
---|
28 | -- Create includeFile function that preparses the file according |
---|
29 | -- to a function provided to the LuaState constructor (in C++) |
---|
30 | -- Note: See the same notes as for doFile |
---|
31 | include = function(filename, resourceGroup) |
---|
32 | local bSearchOtherPaths = (resourceGroup == nil) or false |
---|
33 | resourceGroup = resourceGroup or "NoResourceGroupProvided" |
---|
34 | luaState:includeFile(filename, resourceGroup, bSearchOtherPaths) |
---|
35 | end |
---|