diff options
| author | OpportunityLiu <[email protected]> | 2019-07-01 14:19:05 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-07-01 14:19:05 +0800 |
| commit | f40152174188626df4b70ca1b9044a721fd3c6e8 (patch) | |
| tree | 388f5b8e3acdcf1bc9253556fe762dc8b09a5d2a /xmake/plugins/lua/xmake.lua | |
| parent | 19cbd06f95dddacd1247d1dffab9fa29d719d02b (diff) | |
utf8 support
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
| -rw-r--r-- | xmake/plugins/lua/xmake.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua index 32c929001..b6d66a670 100644 --- a/xmake/plugins/lua/xmake.lua +++ b/xmake/plugins/lua/xmake.lua @@ -54,14 +54,16 @@ task("lua") if script then -- import and run script - if os.isfile(script) then + if path.extension(script) == ".lua" and os.isfile(script) then -- run the given lua script file (xmake lua /tmp/script.lua) + vprint("runing given lua script file: %s", path.relative(script)) import(path.basename(script), {rootdir = path.directory(script), anonymous = true})(unpack(option.get("arguments") or {})) elseif os.isfile(path.join(os.scriptdir(), "scripts", script .. ".lua")) then -- run builtin lua script (xmake lua echo "hello xmake") + vprint("runing builtin lua script: %s", script) import("scripts." .. script, {anonymous = true})(unpack(option.get("arguments") or {})) else @@ -76,9 +78,11 @@ task("lua") local result = nil if object then -- run builtin modules (xmake lua core.xxx.xxx) + vprint("runing builtin module: %s", script) result = object(unpack(option.get("arguments") or {})) else -- run imported modules (xmake lua core.xxx.xxx) + vprint("runing imported module: %s", script) result = import(script, {anonymous = true})(unpack(option.get("arguments") or {})) end if result ~= nil then utils.dump(result) end |
