mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
This adds a utility library for handling all the nasty lua referencing stuff. It also provides functions for convienent usage of lua objects such as tables and functions which allows to use them directly from C++ code without using the ugly Lua C-API.
34 lines
633 B
C++
34 lines
633 B
C++
|
|
#include "LuaUtil.h"
|
|
|
|
namespace luacpp {
|
|
namespace util {
|
|
const char* getValueName(ValueType type) {
|
|
switch (type) {
|
|
case ValueType::NONE:
|
|
return "none";
|
|
case ValueType::NIL:
|
|
return "nil";
|
|
case ValueType::BOOLEAN:
|
|
return "boolean";
|
|
case ValueType::LIGHTUSERDATA:
|
|
return "light userdata";
|
|
case ValueType::STRING:
|
|
return "string";
|
|
case ValueType::NUMBER:
|
|
return "number";
|
|
case ValueType::TABLE:
|
|
return "table";
|
|
case ValueType::FUNCTION:
|
|
return "function";
|
|
case ValueType::USERDATA:
|
|
return "userdata";
|
|
case ValueType::THREAD:
|
|
return "thread";
|
|
default:
|
|
return "unknown";
|
|
}
|
|
}
|
|
}
|
|
}
|