@gamely/gly-engine-lite 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.lua +82 -71
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,37 +1,37 @@
1
- local b25a2 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
2
- local r25a2 = function(i, f)
1
+ local b25c2 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
2
+ local r25c2 = function(i, f)
3
3
  return function()
4
4
  local c = f()
5
- b25a2[i] = function() return c end
5
+ b25c2[i] = function() return c end
6
6
  return c
7
7
  end
8
8
  end
9
9
  local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
10
- local function m25a2()
11
- local version = b25a2[1]('source_version')
12
- local loadcore = b25a2[2]('source_shared_engine_loadcore')
13
- local loadgame = b25a2[3]('source_shared_engine_loadgame')
14
- local engine_encoder = b25a2[4]('source_engine_api_data_encoder')
15
- local engine_game = b25a2[5]('source_engine_api_system_app')
16
- local engine_hash = b25a2[6]('source_engine_api_data_hash')
17
- local engine_http = b25a2[7]('source_engine_api_io_http')
18
- local engine_i18n = b25a2[8]('source_engine_api_data_i18n')
19
- local engine_key = b25a2[9]('source_engine_api_system_key')
20
- local engine_env = b25a2[10]('source_engine_api_system_getenv')
21
- local engine_log = b25a2[11]('source_engine_api_debug_log')
22
- local engine_math = b25a2[12]('source_engine_api_math_basic')
23
- local engine_math_clib = b25a2[13]('source_engine_api_math_clib')
24
- local engine_math_random = b25a2[14]('source_engine_api_math_random')
25
- local engine_array = b25a2[15]('source_engine_api_data_array')
26
- local engine_media = b25a2[16]('source_engine_api_io_media')
27
- local engine_api_draw_fps = b25a2[17]('source_engine_api_draw_fps')
28
- local engine_api_draw_text = b25a2[18]('source_engine_api_draw_text')
29
- local engine_api_draw_poly = b25a2[19]('source_engine_api_draw_poly')
30
- local engine_raw_memory = b25a2[20]('source_engine_api_raw_memory')
31
- local callback_http = b25a2[21]('source_engine_protocol_http_callback')
32
- local application_default = b25a2[22]('source_shared_var_object_root')
33
- local color = b25a2[23]('source_engine_api_system_color')
34
- local std = b25a2[24]('source_shared_var_object_std')
10
+ local function m25c2()
11
+ local version = b25c2[1]('source_version')
12
+ local loadcore = b25c2[2]('source_shared_engine_loadcore')
13
+ local loadgame = b25c2[3]('source_shared_engine_loadgame')
14
+ local engine_encoder = b25c2[4]('source_engine_api_data_encoder')
15
+ local engine_game = b25c2[5]('source_engine_api_system_app')
16
+ local engine_hash = b25c2[6]('source_engine_api_data_hash')
17
+ local engine_http = b25c2[7]('source_engine_api_io_http')
18
+ local engine_i18n = b25c2[8]('source_engine_api_data_i18n')
19
+ local engine_key = b25c2[9]('source_engine_api_system_key')
20
+ local engine_env = b25c2[10]('source_engine_api_system_getenv')
21
+ local engine_log = b25c2[11]('source_engine_api_debug_log')
22
+ local engine_math = b25c2[12]('source_engine_api_math_basic')
23
+ local engine_math_clib = b25c2[13]('source_engine_api_math_clib')
24
+ local engine_math_random = b25c2[14]('source_engine_api_math_random')
25
+ local engine_array = b25c2[15]('source_engine_api_data_array')
26
+ local engine_media = b25c2[16]('source_engine_api_io_media')
27
+ local engine_api_draw_fps = b25c2[17]('source_engine_api_draw_fps')
28
+ local engine_api_draw_text = b25c2[18]('source_engine_api_draw_text')
29
+ local engine_api_draw_poly = b25c2[19]('source_engine_api_draw_poly')
30
+ local engine_raw_memory = b25c2[20]('source_engine_api_raw_memory')
31
+ local callback_http = b25c2[21]('source_engine_protocol_http_callback')
32
+ local application_default = b25c2[22]('source_shared_var_object_root')
33
+ local color = b25c2[23]('source_engine_api_system_color')
34
+ local std = b25c2[24]('source_shared_var_object_std')
35
35
  local application = application_default
36
36
  local engine = {
37
37
  keyboard = function(a, b, c, d) end,
@@ -193,12 +193,12 @@ version=version
193
193
  }
194
194
  return P
195
195
  end
196
- b25a2[1] = r25a2(1, function()
197
- return '0.3.2'
196
+ b25c2[1] = r25c2(1, function()
197
+ return '0.3.4'
198
198
  end)
199
- b25a2[2] = r25a2(2, function()
200
- local zeebo_pipeline = b25a2[25]('source_shared_functional_pipeline')
201
- local requires = b25a2[26]('source_shared_string_dsl_requires')
199
+ b25c2[2] = r25c2(2, function()
200
+ local zeebo_pipeline = b25c2[25]('source_shared_functional_pipeline')
201
+ local requires = b25c2[26]('source_shared_string_dsl_requires')
202
202
  local function step_install_libsys(self, lib_name, library, custom, is_system)
203
203
  if not is_system then return end
204
204
  local ok, msg = pcall(function()
@@ -279,9 +279,9 @@ setup = setup
279
279
  }
280
280
  return P
281
281
  end)
282
- b25a2[3] = r25a2(3, function()
283
- local eval_file = b25a2[27]('source_shared_string_eval_file')
284
- local eval_code = b25a2[28]('source_shared_string_eval_code')
282
+ b25c2[3] = r25c2(3, function()
283
+ local eval_file = b25c2[27]('source_shared_string_eval_file')
284
+ local eval_code = b25c2[28]('source_shared_string_eval_code')
285
285
  local has_io_open = io and io.open
286
286
  local function normalize(app, base)
287
287
  if not app then return nil end
@@ -355,7 +355,7 @@ script = script
355
355
  }
356
356
  return P
357
357
  end)
358
- b25a2[4] = r25a2(4, function()
358
+ b25c2[4] = r25c2(4, function()
359
359
  local function install(std, engine, library, name)
360
360
  std = std or {}
361
361
  std[name] = {
@@ -369,7 +369,7 @@ install=install
369
369
  }
370
370
  return P
371
371
  end)
372
- b25a2[5] = r25a2(5, function()
372
+ b25c2[5] = r25c2(5, function()
373
373
  local function reset(std, engine)
374
374
  if std.node then
375
375
  return function()
@@ -395,6 +395,11 @@ func(window_name)
395
395
  end
396
396
  end
397
397
  end
398
+ local function get_info(my, info)
399
+ return function()
400
+ return my.root.meta[info]
401
+ end
402
+ end
398
403
  local function install(std, engine, config)
399
404
  std = std or {}
400
405
  config = config or {}
@@ -407,6 +412,8 @@ end)
407
412
  std.app.title = title(config.set_title)
408
413
  std.app.exit = exit(std)
409
414
  std.app.reset = reset(std, engine)
415
+ std.app.get_name = get_info(engine, 'title')
416
+ std.app.get_version = get_info(engine, 'version')
410
417
  std.app.get_fps = config.get_fps
411
418
  return std.app
412
419
  end
@@ -415,7 +422,7 @@ install=install
415
422
  }
416
423
  return P
417
424
  end)
418
- b25a2[6] = r25a2(6, function()
425
+ b25c2[6] = r25c2(6, function()
419
426
  local function djb2(digest)
420
427
  local index = 1
421
428
  local hash = 5381
@@ -438,8 +445,8 @@ install = install
438
445
  }
439
446
  return P
440
447
  end)
441
- b25a2[7] = r25a2(7, function()
442
- local zeebo_pipeline = b25a2[25]('source_shared_functional_pipeline')
448
+ b25c2[7] = r25c2(7, function()
449
+ local zeebo_pipeline = b25c2[25]('source_shared_functional_pipeline')
443
450
  local function json(self)
444
451
  self.options['json'] = true
445
452
  return self
@@ -543,10 +550,14 @@ protocol.handler(self, self.id)
543
550
  end,
544
551
  function()
545
552
  if self.options['json'] and json_decode and std.http.body then
546
- pcall(function()
553
+ local ok, err = pcall(function()
547
554
  local new_body = json_decode(std.http.body)
548
555
  std.http.body = new_body
549
556
  end)
557
+ if not ok then
558
+ self.set('ok', false)
559
+ self.set('error', err)
560
+ end
550
561
  end
551
562
  local lower_header = {}
552
563
  for k, v in pairs(std.http.headers or {}) do
@@ -601,7 +612,7 @@ install=install
601
612
  }
602
613
  return P
603
614
  end)
604
- b25a2[8] = r25a2(8, function()
615
+ b25c2[8] = r25c2(8, function()
605
616
  local language = 'en-US'
606
617
  local language_default = 'en-US'
607
618
  local language_list = {}
@@ -692,7 +703,7 @@ install=install
692
703
  }
693
704
  return P
694
705
  end)
695
- b25a2[9] = r25a2(9, function()
706
+ b25c2[9] = r25c2(9, function()
696
707
  local function real_key(std, engine, rkey, rvalue)
697
708
  local value = (rvalue == 1 or rvalue == true) or false
698
709
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -741,7 +752,7 @@ return {
741
752
  install = install
742
753
  }
743
754
  end)
744
- b25a2[10] = r25a2(10, function()
755
+ b25c2[10] = r25c2(10, function()
745
756
  local function setenv(engine)
746
757
  return function(varname, value)
747
758
  if engine.root ~= engine.current then
@@ -784,8 +795,8 @@ install = install
784
795
  }
785
796
  return P
786
797
  end)
787
- b25a2[11] = r25a2(11, function()
788
- local util_decorator = b25a2[29]('source_shared_functional_decorator')
798
+ b25c2[11] = r25c2(11, function()
799
+ local util_decorator = b25c2[29]('source_shared_functional_decorator')
789
800
  local logging_types = {
790
801
  'none', 'fatal', 'error', 'warn', 'debug', 'info'
791
802
  }
@@ -830,7 +841,7 @@ install = install
830
841
  }
831
842
  return P
832
843
  end)
833
- b25a2[12] = r25a2(12, function()
844
+ b25c2[12] = r25c2(12, function()
834
845
  local function abs(value)
835
846
  if value < 0 then
836
847
  return -value
@@ -928,7 +939,7 @@ install = install
928
939
  }
929
940
  return P
930
941
  end)
931
- b25a2[13] = r25a2(13, function()
942
+ b25c2[13] = r25c2(13, function()
932
943
  local function install(std)
933
944
  assert(math and (1/2 ~= 0))
934
945
  std.math = std.math or {}
@@ -963,7 +974,7 @@ install = install
963
974
  }
964
975
  return P
965
976
  end)
966
- b25a2[14] = r25a2(14, function()
977
+ b25c2[14] = r25c2(14, function()
967
978
  local function install(std)
968
979
  assert(math and (1/2 ~= 0))
969
980
  std.math = std.math or {}
@@ -979,8 +990,8 @@ install = install
979
990
  }
980
991
  return P
981
992
  end)
982
- b25a2[15] = r25a2(15, function()
983
- local util_decorator = b25a2[29]('source_shared_functional_decorator')
993
+ b25c2[15] = r25c2(15, function()
994
+ local util_decorator = b25c2[29]('source_shared_functional_decorator')
984
995
  local function array_map(array, func)
985
996
  local res = {}
986
997
  local index = 1
@@ -1140,7 +1151,7 @@ install = install
1140
1151
  }
1141
1152
  return P
1142
1153
  end)
1143
- b25a2[16] = r25a2(16, function()
1154
+ b25c2[16] = r25c2(16, function()
1144
1155
  local function media_create(node, channels, handler)
1145
1156
  local decorator = function(func)
1146
1157
  func = func or function() end
@@ -1186,7 +1197,7 @@ install=install
1186
1197
  }
1187
1198
  return P
1188
1199
  end)
1189
- b25a2[17] = r25a2(17, function()
1200
+ b25c2[17] = r25c2(17, function()
1190
1201
  local function draw_fps(std, engine, show, pos_x, pos_y)
1191
1202
  if show < 1 then return end
1192
1203
  local x = engine.current.config.offset_x + pos_x
@@ -1234,7 +1245,7 @@ install=install
1234
1245
  }
1235
1246
  return P
1236
1247
  end)
1237
- b25a2[18] = r25a2(18, function()
1248
+ b25c2[18] = r25c2(18, function()
1238
1249
  local function text_put(std, engine, font_previous)
1239
1250
  return function(pos_x, pos_y, text, size)
1240
1251
  size = size or 2
@@ -1266,7 +1277,7 @@ install=install
1266
1277
  }
1267
1278
  return P
1268
1279
  end)
1269
- b25a2[19] = r25a2(19, function()
1280
+ b25c2[19] = r25c2(19, function()
1270
1281
  local function decorator_poo(object, func)
1271
1282
  if not object or not func then return func end
1272
1283
  return function(a, b, c, d)
@@ -1372,7 +1383,7 @@ install=install
1372
1383
  }
1373
1384
  return P
1374
1385
  end)
1375
- b25a2[20] = r25a2(20, function()
1386
+ b25c2[20] = r25c2(20, function()
1376
1387
  local memory_dict_unload = {}
1377
1388
  local memory_dict = {}
1378
1389
  local memory_list = {}
@@ -1426,9 +1437,9 @@ install=install
1426
1437
  }
1427
1438
  return P
1428
1439
  end)
1429
- b25a2[21] = r25a2(21, function()
1430
- local str_http = b25a2[31]('source_shared_string_encode_http')
1431
- local str_url = b25a2[32]('source_shared_string_encode_url')
1440
+ b25c2[21] = r25c2(21, function()
1441
+ local str_http = b25c2[31]('source_shared_string_encode_http')
1442
+ local str_url = b25c2[32]('source_shared_string_encode_url')
1432
1443
  local callbacks = {
1433
1444
  ['async-promise'] = function(self)
1434
1445
  return self:promise()
@@ -1497,7 +1508,7 @@ func = native_http_callback
1497
1508
  }
1498
1509
  return P
1499
1510
  end)
1500
- b25a2[22] = r25a2(22, function()
1511
+ b25c2[22] = r25c2(22, function()
1501
1512
  local P = {
1502
1513
  data={
1503
1514
  width=1280,
@@ -1526,7 +1537,7 @@ callbacks={
1526
1537
  }
1527
1538
  return P;
1528
1539
  end)
1529
- b25a2[23] = r25a2(23, function()
1540
+ b25c2[23] = r25c2(23, function()
1530
1541
  local function install(std)
1531
1542
  std.color = std.color or {}
1532
1543
  std.color.white = 0xFFFFFFFF
@@ -1560,7 +1571,7 @@ install = install
1560
1571
  }
1561
1572
  return P
1562
1573
  end)
1563
- b25a2[24] = r25a2(24, function()
1574
+ b25c2[24] = r25c2(24, function()
1564
1575
  local P = {
1565
1576
  milis = 0,
1566
1577
  delta = 0,
@@ -1627,7 +1638,7 @@ any=false
1627
1638
  }
1628
1639
  return P;
1629
1640
  end)
1630
- b25a2[25] = r25a2(25, function()
1641
+ b25c2[25] = r25c2(25, function()
1631
1642
  local function pipe(self)
1632
1643
  return function()
1633
1644
  self:run()
@@ -1676,7 +1687,7 @@ run=run
1676
1687
  }
1677
1688
  return P
1678
1689
  end)
1679
- b25a2[26] = r25a2(26, function()
1690
+ b25c2[26] = r25c2(26, function()
1680
1691
  local function encode(dsl_string)
1681
1692
  local spec = {
1682
1693
  list = {},
@@ -1724,7 +1735,7 @@ should_import = should_import
1724
1735
  }
1725
1736
  return P
1726
1737
  end)
1727
- b25a2[27] = r25a2(27, function()
1738
+ b25c2[27] = r25c2(27, function()
1728
1739
  local function script(src)
1729
1740
  local ok, app = false, nil
1730
1741
  if require then
@@ -1749,7 +1760,7 @@ script = script,
1749
1760
  }
1750
1761
  return P
1751
1762
  end)
1752
- b25a2[28] = r25a2(28, function()
1763
+ b25c2[28] = r25c2(28, function()
1753
1764
  local function script(src)
1754
1765
  local loader = loadstring or load
1755
1766
  if not loader then
@@ -1769,7 +1780,7 @@ script = script,
1769
1780
  }
1770
1781
  return P
1771
1782
  end)
1772
- b25a2[29] = r25a2(29, function()
1783
+ b25c2[29] = r25c2(29, function()
1773
1784
  local function decorator_prefix3(zig, zag, zom, func)
1774
1785
  return function (a, b, c, d, e, f)
1775
1786
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1826,7 +1837,7 @@ prefix1_t = table_prefix1
1826
1837
  }
1827
1838
  return P
1828
1839
  end)
1829
- b25a2[31] = r25a2(31, function()
1840
+ b25c2[31] = r25c2(31, function()
1830
1841
  local function is_ok(status)
1831
1842
  return (status and 200 <= status and status < 300) or false
1832
1843
  end
@@ -1972,7 +1983,7 @@ get_user_agent=get_user_agent,
1972
1983
  create_request=create_request
1973
1984
  }
1974
1985
  end)
1975
- b25a2[32] = r25a2(32, function()
1986
+ b25c2[32] = r25c2(32, function()
1976
1987
  local function search_param(param_list, param_dict)
1977
1988
  local index, params = 1, ''
1978
1989
  while param_list and param_dict and index <= #param_list do
@@ -1993,4 +2004,4 @@ search_param = search_param
1993
2004
  }
1994
2005
  return P
1995
2006
  end)
1996
- return m25a2()
2007
+ return m25c2()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",