LuaModule.cs 577 B

1234567891011121314151617181920212223242526272829
  1. namespace Lua;
  2. public enum LuaModuleType
  3. {
  4. Text,
  5. }
  6. public readonly struct LuaModule
  7. {
  8. public string Name => name;
  9. public LuaModuleType Type => type;
  10. readonly string name;
  11. readonly LuaModuleType type;
  12. readonly object referenceValue;
  13. public LuaModule(string name, string text)
  14. {
  15. this.name = name;
  16. type = LuaModuleType.Text;
  17. referenceValue = text;
  18. }
  19. public string ReadText()
  20. {
  21. if (type != LuaModuleType.Text) throw new Exception(); // TODO: add message
  22. return (string)referenceValue;
  23. }
  24. }