@gamely/gly-engine-lite 0.3.1 → 0.3.3

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 +85 -72
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,37 +1,37 @@
1
- local b259c = {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 r259c = 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
- b259c[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 m259c()
11
- local version = b259c[1]('source_version')
12
- local loadcore = b259c[2]('source_shared_engine_loadcore')
13
- local loadgame = b259c[3]('source_shared_engine_loadgame')
14
- local engine_encoder = b259c[4]('source_engine_api_data_encoder')
15
- local engine_game = b259c[5]('source_engine_api_system_app')
16
- local engine_hash = b259c[6]('source_engine_api_data_hash')
17
- local engine_http = b259c[7]('source_engine_api_io_http')
18
- local engine_i18n = b259c[8]('source_engine_api_data_i18n')
19
- local engine_key = b259c[9]('source_engine_api_system_key')
20
- local engine_env = b259c[10]('source_engine_api_system_getenv')
21
- local engine_log = b259c[11]('source_engine_api_debug_log')
22
- local engine_math = b259c[12]('source_engine_api_math_basic')
23
- local engine_math_clib = b259c[13]('source_engine_api_math_clib')
24
- local engine_math_random = b259c[14]('source_engine_api_math_random')
25
- local engine_array = b259c[15]('source_engine_api_data_array')
26
- local engine_media = b259c[16]('source_engine_api_io_media')
27
- local engine_api_draw_fps = b259c[17]('source_engine_api_draw_fps')
28
- local engine_api_draw_text = b259c[18]('source_engine_api_draw_text')
29
- local engine_api_draw_poly = b259c[19]('source_engine_api_draw_poly')
30
- local engine_raw_memory = b259c[20]('source_engine_api_raw_memory')
31
- local callback_http = b259c[21]('source_engine_protocol_http_callback')
32
- local application_default = b259c[22]('source_shared_var_object_root')
33
- local color = b259c[23]('source_engine_api_system_color')
34
- local std = b259c[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
- b259c[1] = r259c(1, function()
197
- return '0.3.1'
196
+ b25c2[1] = r25c2(1, function()
197
+ return '0.3.3'
198
198
  end)
199
- b259c[2] = r259c(2, function()
200
- local zeebo_pipeline = b259c[25]('source_shared_functional_pipeline')
201
- local requires = b259c[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,15 +279,15 @@ setup = setup
279
279
  }
280
280
  return P
281
281
  end)
282
- b259c[3] = r259c(3, function()
283
- local eval_file = b259c[27]('source_shared_string_eval_file')
284
- local eval_code = b259c[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
288
288
  if not app.callbacks then
289
289
  local old_app = app
290
- app = {meta={},config={},callbacks={}, data={}}
290
+ app = {meta={},config={},callbacks={}, data={}, envs={}}
291
291
  for key, value in pairs(old_app) do
292
292
  local is_function = type(value) == 'function'
293
293
  if base.meta and base.meta[key] and not is_function then
@@ -296,6 +296,8 @@ elseif base.config and base.config[key] and not is_function then
296
296
  app.config[key] = value
297
297
  elseif is_function then
298
298
  app.callbacks[key] = value
299
+ elseif app[key] then
300
+ app[key] = value
299
301
  else
300
302
  app.data[key] = value
301
303
  end
@@ -353,7 +355,7 @@ script = script
353
355
  }
354
356
  return P
355
357
  end)
356
- b259c[4] = r259c(4, function()
358
+ b25c2[4] = r25c2(4, function()
357
359
  local function install(std, engine, library, name)
358
360
  std = std or {}
359
361
  std[name] = {
@@ -367,7 +369,7 @@ install=install
367
369
  }
368
370
  return P
369
371
  end)
370
- b259c[5] = r259c(5, function()
372
+ b25c2[5] = r25c2(5, function()
371
373
  local function reset(std, engine)
372
374
  if std.node then
373
375
  return function()
@@ -393,6 +395,11 @@ func(window_name)
393
395
  end
394
396
  end
395
397
  end
398
+ local function get_info(my, info)
399
+ return function()
400
+ return my.root.meta[info]
401
+ end
402
+ end
396
403
  local function install(std, engine, config)
397
404
  std = std or {}
398
405
  config = config or {}
@@ -405,6 +412,8 @@ end)
405
412
  std.app.title = title(config.set_title)
406
413
  std.app.exit = exit(std)
407
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')
408
417
  std.app.get_fps = config.get_fps
409
418
  return std.app
410
419
  end
@@ -413,7 +422,7 @@ install=install
413
422
  }
414
423
  return P
415
424
  end)
416
- b259c[6] = r259c(6, function()
425
+ b25c2[6] = r25c2(6, function()
417
426
  local function djb2(digest)
418
427
  local index = 1
419
428
  local hash = 5381
@@ -436,8 +445,8 @@ install = install
436
445
  }
437
446
  return P
438
447
  end)
439
- b259c[7] = r259c(7, function()
440
- local zeebo_pipeline = b259c[25]('source_shared_functional_pipeline')
448
+ b25c2[7] = r25c2(7, function()
449
+ local zeebo_pipeline = b25c2[25]('source_shared_functional_pipeline')
441
450
  local function json(self)
442
451
  self.options['json'] = true
443
452
  return self
@@ -541,10 +550,14 @@ protocol.handler(self, self.id)
541
550
  end,
542
551
  function()
543
552
  if self.options['json'] and json_decode and std.http.body then
544
- pcall(function()
553
+ local ok, err = pcall(function()
545
554
  local new_body = json_decode(std.http.body)
546
555
  std.http.body = new_body
547
556
  end)
557
+ if not ok then
558
+ self.set('ok', false)
559
+ self.set('error', err)
560
+ end
548
561
  end
549
562
  local lower_header = {}
550
563
  for k, v in pairs(std.http.headers or {}) do
@@ -599,7 +612,7 @@ install=install
599
612
  }
600
613
  return P
601
614
  end)
602
- b259c[8] = r259c(8, function()
615
+ b25c2[8] = r25c2(8, function()
603
616
  local language = 'en-US'
604
617
  local language_default = 'en-US'
605
618
  local language_list = {}
@@ -690,7 +703,7 @@ install=install
690
703
  }
691
704
  return P
692
705
  end)
693
- b259c[9] = r259c(9, function()
706
+ b25c2[9] = r25c2(9, function()
694
707
  local function real_key(std, engine, rkey, rvalue)
695
708
  local value = (rvalue == 1 or rvalue == true) or false
696
709
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -739,7 +752,7 @@ return {
739
752
  install = install
740
753
  }
741
754
  end)
742
- b259c[10] = r259c(10, function()
755
+ b25c2[10] = r25c2(10, function()
743
756
  local function setenv(engine)
744
757
  return function(varname, value)
745
758
  if engine.root ~= engine.current then
@@ -782,8 +795,8 @@ install = install
782
795
  }
783
796
  return P
784
797
  end)
785
- b259c[11] = r259c(11, function()
786
- local util_decorator = b259c[29]('source_shared_functional_decorator')
798
+ b25c2[11] = r25c2(11, function()
799
+ local util_decorator = b25c2[29]('source_shared_functional_decorator')
787
800
  local logging_types = {
788
801
  'none', 'fatal', 'error', 'warn', 'debug', 'info'
789
802
  }
@@ -828,7 +841,7 @@ install = install
828
841
  }
829
842
  return P
830
843
  end)
831
- b259c[12] = r259c(12, function()
844
+ b25c2[12] = r25c2(12, function()
832
845
  local function abs(value)
833
846
  if value < 0 then
834
847
  return -value
@@ -926,7 +939,7 @@ install = install
926
939
  }
927
940
  return P
928
941
  end)
929
- b259c[13] = r259c(13, function()
942
+ b25c2[13] = r25c2(13, function()
930
943
  local function install(std)
931
944
  assert(math and (1/2 ~= 0))
932
945
  std.math = std.math or {}
@@ -961,7 +974,7 @@ install = install
961
974
  }
962
975
  return P
963
976
  end)
964
- b259c[14] = r259c(14, function()
977
+ b25c2[14] = r25c2(14, function()
965
978
  local function install(std)
966
979
  assert(math and (1/2 ~= 0))
967
980
  std.math = std.math or {}
@@ -977,8 +990,8 @@ install = install
977
990
  }
978
991
  return P
979
992
  end)
980
- b259c[15] = r259c(15, function()
981
- local util_decorator = b259c[29]('source_shared_functional_decorator')
993
+ b25c2[15] = r25c2(15, function()
994
+ local util_decorator = b25c2[29]('source_shared_functional_decorator')
982
995
  local function array_map(array, func)
983
996
  local res = {}
984
997
  local index = 1
@@ -1138,7 +1151,7 @@ install = install
1138
1151
  }
1139
1152
  return P
1140
1153
  end)
1141
- b259c[16] = r259c(16, function()
1154
+ b25c2[16] = r25c2(16, function()
1142
1155
  local function media_create(node, channels, handler)
1143
1156
  local decorator = function(func)
1144
1157
  func = func or function() end
@@ -1184,7 +1197,7 @@ install=install
1184
1197
  }
1185
1198
  return P
1186
1199
  end)
1187
- b259c[17] = r259c(17, function()
1200
+ b25c2[17] = r25c2(17, function()
1188
1201
  local function draw_fps(std, engine, show, pos_x, pos_y)
1189
1202
  if show < 1 then return end
1190
1203
  local x = engine.current.config.offset_x + pos_x
@@ -1232,7 +1245,7 @@ install=install
1232
1245
  }
1233
1246
  return P
1234
1247
  end)
1235
- b259c[18] = r259c(18, function()
1248
+ b25c2[18] = r25c2(18, function()
1236
1249
  local function text_put(std, engine, font_previous)
1237
1250
  return function(pos_x, pos_y, text, size)
1238
1251
  size = size or 2
@@ -1264,7 +1277,7 @@ install=install
1264
1277
  }
1265
1278
  return P
1266
1279
  end)
1267
- b259c[19] = r259c(19, function()
1280
+ b25c2[19] = r25c2(19, function()
1268
1281
  local function decorator_poo(object, func)
1269
1282
  if not object or not func then return func end
1270
1283
  return function(a, b, c, d)
@@ -1370,7 +1383,7 @@ install=install
1370
1383
  }
1371
1384
  return P
1372
1385
  end)
1373
- b259c[20] = r259c(20, function()
1386
+ b25c2[20] = r25c2(20, function()
1374
1387
  local memory_dict_unload = {}
1375
1388
  local memory_dict = {}
1376
1389
  local memory_list = {}
@@ -1424,9 +1437,9 @@ install=install
1424
1437
  }
1425
1438
  return P
1426
1439
  end)
1427
- b259c[21] = r259c(21, function()
1428
- local str_http = b259c[31]('source_shared_string_encode_http')
1429
- local str_url = b259c[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')
1430
1443
  local callbacks = {
1431
1444
  ['async-promise'] = function(self)
1432
1445
  return self:promise()
@@ -1495,7 +1508,7 @@ func = native_http_callback
1495
1508
  }
1496
1509
  return P
1497
1510
  end)
1498
- b259c[22] = r259c(22, function()
1511
+ b25c2[22] = r25c2(22, function()
1499
1512
  local P = {
1500
1513
  data={
1501
1514
  width=1280,
@@ -1524,7 +1537,7 @@ callbacks={
1524
1537
  }
1525
1538
  return P;
1526
1539
  end)
1527
- b259c[23] = r259c(23, function()
1540
+ b25c2[23] = r25c2(23, function()
1528
1541
  local function install(std)
1529
1542
  std.color = std.color or {}
1530
1543
  std.color.white = 0xFFFFFFFF
@@ -1558,7 +1571,7 @@ install = install
1558
1571
  }
1559
1572
  return P
1560
1573
  end)
1561
- b259c[24] = r259c(24, function()
1574
+ b25c2[24] = r25c2(24, function()
1562
1575
  local P = {
1563
1576
  milis = 0,
1564
1577
  delta = 0,
@@ -1625,7 +1638,7 @@ any=false
1625
1638
  }
1626
1639
  return P;
1627
1640
  end)
1628
- b259c[25] = r259c(25, function()
1641
+ b25c2[25] = r25c2(25, function()
1629
1642
  local function pipe(self)
1630
1643
  return function()
1631
1644
  self:run()
@@ -1674,7 +1687,7 @@ run=run
1674
1687
  }
1675
1688
  return P
1676
1689
  end)
1677
- b259c[26] = r259c(26, function()
1690
+ b25c2[26] = r25c2(26, function()
1678
1691
  local function encode(dsl_string)
1679
1692
  local spec = {
1680
1693
  list = {},
@@ -1722,7 +1735,7 @@ should_import = should_import
1722
1735
  }
1723
1736
  return P
1724
1737
  end)
1725
- b259c[27] = r259c(27, function()
1738
+ b25c2[27] = r25c2(27, function()
1726
1739
  local function script(src)
1727
1740
  local ok, app = false, nil
1728
1741
  if require then
@@ -1747,7 +1760,7 @@ script = script,
1747
1760
  }
1748
1761
  return P
1749
1762
  end)
1750
- b259c[28] = r259c(28, function()
1763
+ b25c2[28] = r25c2(28, function()
1751
1764
  local function script(src)
1752
1765
  local loader = loadstring or load
1753
1766
  if not loader then
@@ -1767,7 +1780,7 @@ script = script,
1767
1780
  }
1768
1781
  return P
1769
1782
  end)
1770
- b259c[29] = r259c(29, function()
1783
+ b25c2[29] = r25c2(29, function()
1771
1784
  local function decorator_prefix3(zig, zag, zom, func)
1772
1785
  return function (a, b, c, d, e, f)
1773
1786
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1824,7 +1837,7 @@ prefix1_t = table_prefix1
1824
1837
  }
1825
1838
  return P
1826
1839
  end)
1827
- b259c[31] = r259c(31, function()
1840
+ b25c2[31] = r25c2(31, function()
1828
1841
  local function is_ok(status)
1829
1842
  return (status and 200 <= status and status < 300) or false
1830
1843
  end
@@ -1970,7 +1983,7 @@ get_user_agent=get_user_agent,
1970
1983
  create_request=create_request
1971
1984
  }
1972
1985
  end)
1973
- b259c[32] = r259c(32, function()
1986
+ b25c2[32] = r25c2(32, function()
1974
1987
  local function search_param(param_list, param_dict)
1975
1988
  local index, params = 1, ''
1976
1989
  while param_list and param_dict and index <= #param_list do
@@ -1991,4 +2004,4 @@ search_param = search_param
1991
2004
  }
1992
2005
  return P
1993
2006
  end)
1994
- return m259c()
2007
+ return m25c2()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",