Thank you both for tips and links very much!
I used that last link posted by @XeduR to get parameters from url.
Here is how I did it in case someone would use it:
url
someweb.com?gameid=somegameid
main.lua
local jsp = require ( "jsurlparameter" )
local params = jsp.get()
local GameID = params.gameid
display.newText (
{
text = GameID or "N/A",
x = display.contentCenterX,
y = display.contentCenterY,
font = native.systemFont,
fontSize = 18
}
)
in jsurlparameter.lua (wrapper for simulator).
if system.getInfo("platform") == 'html5' then
return require "jsurlparameter_js"
else
local lib = {}
setmetatable( lib, {__index = function( t, k )
return function()
print( "WARNING: Placeholder is called for " .. k )
end
end} )
lib.get = function ()
return ( { gameid = "7777-d" } ) --for testing in simulator
end
return lib
end
finally in jsurlparameter_js.js
jsurlparameter_js = {
get : function () {
return getParams(window.location.href);
},
}
/**
* Get the URL parameters
* source: https://css-tricks.com/snippets/javascript/get-url-variables/
* @param {String} url The URL
* @return {Object} The URL parameters
*/
var getParams = function (url) {
var params = {};
var parser = document.createElement('a');
parser.href = url;
var query = parser.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
params[pair[0]] = decodeURIComponent(pair[1]);
}
return params;
};