Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: include/utils/SkLua.h

Issue 15742009: expand SkLua to handle creation of its own State (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/utils/SkLua.h
diff --git a/include/utils/SkLua.h b/include/utils/SkLua.h
index 232ba9b8ee4a5fb860dc8b4b705d4905b61741a0..8f48bc1ee19fa054bfa0144d68325af70ccbf204 100644
--- a/include/utils/SkLua.h
+++ b/include/utils/SkLua.h
@@ -10,6 +10,7 @@
#include "SkColor.h"
#include "SkScalar.h"
+#include "SkString.h"
struct lua_State;
@@ -19,7 +20,6 @@ class SkPaint;
class SkPath;
struct SkRect;
class SkRRect;
-class SkString;
#define SkScalarToLua(x) SkScalarToDouble(x)
#define SkLuaToScalar(x) SkDoubleToScalar(x)
@@ -28,11 +28,17 @@ class SkLua {
public:
static void Load(lua_State*);
- SkLua(lua_State*);
+ SkLua(const char termCode[] = NULL); // creates a new L, will close it
+ SkLua(lua_State*); // uses L, will not close it
~SkLua();
- lua_State* getL() const { return fL; }
-
+ lua_State* get() const { return fL; }
+ lua_State* operator*() const { return fL; }
+ lua_State* operator->() const { return fL; }
+
+ bool runCode(const char code[]);
+ bool runCode(const void* code, size_t size);
+
void pushBool(bool, const char tableKey[] = NULL);
void pushString(const char[], const char tableKey[] = NULL);
void pushString(const SkString&, const char tableKey[] = NULL);
@@ -46,7 +52,9 @@ public:
void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
private:
- lua_State* fL;
+ lua_State* fL;
+ SkString fTermCode;
+ bool fWeOwnL;
};
#endif
« no previous file with comments | « gyp/SampleApp.gyp ('k') | samplecode/SampleLua.cpp » ('j') | src/utils/SkLua.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698